';
+
+
+ if ($totalRecords = $importModel->getTotalRecords()) {
+
+ $maxRows = $importModel->getResource()->getMaxRows();
+ echo '';
+ foreach($totalRecords as $importType => $totalRecord) {
+ echo '';
+ $page = floor($totalRecord/$maxRows) + 1;
+ for ($i = 0; $i < $page; $i++) {
+ $data = array(
+ 'import_id' => $importModel->getId(),
+ 'import_type' => $importType,
+ 'from' => ($i > 0 ? $i * $maxRows:$i),
+ 'is_done' => ($i == $page - 1)?true:false
+ );
+ echo '';
+ }
+
+// if ($importType=='categories') {
+// $data = array(
+// 'import_id' => $importModel->getId(),
+// 'import_type' => $importType,
+// 'page' => 'all',
+// 'is_done' => true
+// );
+// echo '';
+//
+// } else {
+// $page = floor($totalRecord/$maxRows) + 1;
+// for ($i = 0; $i < $page; $i++) {
+// $data = array(
+// 'import_id' => $importModel->getId(),
+// 'import_type' => $importType,
+// 'from' => ($i > 0 ? $i * $maxRows:$i),
+// 'is_done' => ($i == $page - 1)?true:false
+// );
+// echo '';
+// }
+// }
+ }
+ echo '';
+
+ }
+
+ }
+ echo '';
+ exit;
+ }
+}
diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order.php
new file mode 100644
index 0000000000..37c1469f28
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order.php
@@ -0,0 +1,43 @@
+
+ */
+
+class Mage_Oscommerce_Block_Adminhtml_Order extends Mage_Adminhtml_Block_Widget_Grid_Container
+{
+ protected $_blockGroup = 'oscommerce';
+ public function __construct()
+ {
+ $this->_controller = 'adminhtml_order';
+ $this->_headerText = Mage::helper('adminhtml')->__('Manage osCommerce Orders');
+ parent::__construct();
+ $this->_removeButton('add');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/Grid.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/Grid.php
new file mode 100644
index 0000000000..ab5e39cb4b
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/Grid.php
@@ -0,0 +1,128 @@
+
+ */
+
+class Mage_Oscommerce_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Widget_Grid
+{
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setId('oscommerceOrderGrid');
+ $this->setDefaultSort('id');
+ }
+
+ protected function _prepareCollection()
+ {
+ $collection = Mage::getModel('oscommerce/oscommerce_order')->getCollection();
+ $this->setCollection($collection);
+ return parent::_prepareCollection();
+ }
+
+ protected function _prepareColumns()
+ {
+ $this->addColumn('order_id', array(
+ 'header' =>Mage::helper('oscommerce')->__('Order #'),
+ 'width' =>'50px',
+ 'index' =>'osc_magento_id',
+ 'type' => 'number',
+ ));
+
+ $this->addColumn('billing_name', array(
+ 'header' =>Mage::helper('oscommerce')->__('Billing to Name'),
+ 'index' =>'billing_name',
+ ));
+
+ $this->addColumn('delivery_name', array(
+ 'header' =>Mage::helper('oscommerce')->__('Ship to Name'),
+ 'index' =>'delivery_name',
+ ));
+
+ $this->addColumn('currency', array(
+ 'header' =>Mage::helper('oscommerce')->__('Currency'),
+ 'width' =>'50px',
+ 'index' =>'currency',
+ ));
+
+ $this->addColumn('orders_total', array(
+ 'header' =>Mage::helper('oscommerce')->__('Order Total'),
+ 'width' =>'50px',
+ 'index' =>'orders_total',
+ 'type' => 'currency',
+ 'currency'=>'order_currency_code'
+ ));
+
+ $this->addColumn('orders_status', array(
+ 'header' =>Mage::helper('oscommerce')->__('Order Status'),
+ 'width' =>'50px',
+ 'index' =>'orders_status',
+ ));
+
+ $this->addColumn('date_purchased', array(
+ 'header' => Mage::helper('oscommerce')->__('Purchased Year'),
+ 'width' => '150px',
+ 'index' => 'date_purchased',
+ 'type' => 'datetime',
+ ));
+
+// $this->addColumn('purchased_year', array(
+// 'header' =>Mage::helper('oscommerce')->__('Purchased Year'),
+// 'width' =>'50px',
+// 'index' =>'purchased_year',
+// 'type' => 'currency',
+// 'currency' => 'store_currency_code',
+// ));
+//
+// $this->addColumn('purchased_month', array(
+// 'header' =>Mage::helper('oscommerce')->__('Purchased Month'),
+// 'width' =>'50px',
+// 'index' =>'purchased_month',
+// 'type' => 'currency',
+// 'currency' => 'store_currency_code',
+// ));
+//
+// $this->addColumn('purchased_day', array(
+// 'header' =>Mage::helper('oscommerce')->__('Purchased Date'),
+// 'width' =>'50px',
+// 'index' =>'purchased_day',
+// 'type' => 'currency',
+// 'currency' => 'store_currency_code',
+// ));
+
+ return parent::_prepareColumns();
+ }
+
+ public function getRowUrl($row)
+ {
+ return $this->getUrl('*/*/view', array('order_id'=>$row->getId()));
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/View.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/View.php
new file mode 100644
index 0000000000..046a6608ed
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Order/View.php
@@ -0,0 +1,101 @@
+
+ */
+class Mage_Oscommerce_Block_Adminhtml_Order_View extends Mage_Adminhtml_Block_Template
+{
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setTemplate('oscommerce/order/view.phtml');
+
+
+ }
+
+ protected function _prepareLayout()
+ {
+ $this->setChild('backButton',
+ $this->getLayout()->createBlock('adminhtml/widget_button')
+ ->setData(array(
+ 'label' => Mage::helper('oscommerce')->__('Back'),
+ 'id' => 'back_button',
+ 'name' => 'back_button',
+ 'class' => 'scalable back',
+ 'onclick'=> "setLocation('".$this->getBackUrl()."')",
+ ))
+ );
+ }
+ /**
+ * Retrieve order model object
+ *
+ * @return Mage_Sales_Model_Order
+ */
+ public function getOrder()
+ {
+ return Mage::registry('current_oscommerce_order');
+ }
+
+ /**
+ * Retrieve Order Identifier
+ *
+ * @return int
+ */
+ public function getOrderId()
+ {
+ return $this->getOrder()->getId();
+ }
+
+ public function getHeaderText()
+ {
+ $text = Mage::helper('oscommerce')->__('osCommerce Order # %s | Order Date %s',
+ $this->getOrder()->getOrdersId(),
+ $this->formatDate($this->getOrder()->getDatePurchased(), 'medium', true)
+ );
+ return $text;
+ }
+
+ public function getUrl($params='', $params2=array())
+ {
+ $params2['order_id'] = $this->getOrderId();
+ return parent::getUrl($params, $params2);
+ }
+
+
+ public function getBackButtonHtml()
+ {
+ return $this->getChildHtml('backButton');
+ }
+
+ public function getBackUrl()
+ {
+ return $this->getUrl("*/*/");
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/Block/Order/List.php b/app/code/core/Mage/Oscommerce/Block/Order/List.php
new file mode 100644
index 0000000000..5b36840dfd
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Block/Order/List.php
@@ -0,0 +1,73 @@
+
+ */
+class Mage_Oscommerce_Block_Order_List extends Mage_Core_Block_Template
+{
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setTemplate('oscommerce/order/list.phtml');
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
+ $websiteId = $websiteId = Mage::app()->getStore()->getWebsiteId();
+ $osCommerce = Mage::getModel('oscommerce/oscommerce');
+ $oscOrders = $osCommerce->loadOrders($customerId, $websiteId);
+ $this->setOsCommerceOrders($oscOrders);
+ }
+
+ protected function _prepareLayout()
+ {
+ $orderInfo = $this->getOrder();
+ $order = $orderInfo['order'];
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
+ $headBlock->setTitle($this->__('Order # %s', $order['orders_id']));
+ }
+ }
+
+ public function getViewOscommerceUrl($order)
+ {
+ return $this->getUrl('oscommerce/order/view', array('order_id'=>$order['osc_magento_id']));
+ }
+
+ /**
+ * Retrieve current order model instance
+ *
+ * @return Mage_Sales_Model_Order
+ */
+ public function getOrder()
+ {
+ return Mage::registry('current_oscommerce_order');
+ }
+
+ public function getBackUrl()
+ {
+ return Mage::getUrl('*/*/history');
+ }
+}
diff --git a/app/code/core/Mage/Oscommerce/Block/Order/View.php b/app/code/core/Mage/Oscommerce/Block/Order/View.php
new file mode 100644
index 0000000000..4b796ad6f3
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Block/Order/View.php
@@ -0,0 +1,69 @@
+
+ */
+class Mage_Oscommerce_Block_Order_View extends Mage_Core_Block_Template
+{
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setTemplate('oscommerce/order/view.phtml');
+ }
+
+ protected function _prepareLayout()
+ {
+ $orderInfo = $this->getOrder();
+ $order = $orderInfo['order'];
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
+ $headBlock->setTitle($this->__('Order # %s', $order['orders_id']));
+ }
+ }
+
+ public function getPaymentInfoHtml()
+ {
+ return $this->getChildHtml('payment_info');
+ }
+
+ /**
+ * Retrieve current order model instance
+ *
+ * @return Mage_Sales_Model_Order
+ */
+ public function getOrder()
+ {
+ return Mage::registry('current_oscommerce_order');
+ }
+
+ public function getBackUrl()
+ {
+ return Mage::getUrl('sales/order/history');
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/Helper/Data.php b/app/code/core/Mage/Oscommerce/Helper/Data.php
new file mode 100644
index 0000000000..32dceafbc6
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Helper/Data.php
@@ -0,0 +1,35 @@
+
+ */
+class Mage_Oscommerce_Helper_Data extends Mage_Core_Helper_Data
+{
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/Model/Config.php b/app/code/core/Mage/Oscommerce/Model/Config.php
new file mode 100644
index 0000000000..65a96b3dcd
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Model/Config.php
@@ -0,0 +1,49 @@
+
+ */
+class Mage_Oscommerce_Model_Config extends Mage_Core_Model_Config_Base
+{
+ public function __construct()
+ {
+ parent::__construct(Mage::getConfig()->getNode('global'));
+ }
+
+ public function initForeignConnection($data)
+ {
+ $connectionNode = $this->getNode('resources/oscommerce_foreign/connection');
+ if ($connectionNode) {
+ $connectionNode->addChild('host', isset($data['host']) ? $data['host'] : '');
+ $connectionNode->addChild('username', isset($data['db_user']) ? $data['db_user'] : '');
+ $connectionNode->addChild('password', isset($data['db_password']) ? $data['db_password'] : '');
+ $connectionNode->addChild('dbname', isset($data['db_name']) ? $data['db_name'] : '');
+ }
+ }
+}
diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php
new file mode 100644
index 0000000000..ad8fd454ff
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php
@@ -0,0 +1,2113 @@
+
+ */
+class Mage_Oscommerce_Model_Mysql4_Oscommerce extends Mage_Core_Model_Mysql4_Abstract
+{
+ const DEFAULT_DISPLAY_MODE = 'PRODUCTS';
+ const DEFAULT_IS_ANCHOR = '0';
+ const DEFAULT_STORE = 'Default';
+ const DEFAULT_PRODUCT_TYPE = 'Simple';
+ const DEFAULT_ATTRIBUTE_SET = 'Default';
+ const DEFAULT_VISIBILITY = 'Catalog, Search';
+ const DEFAULT_LOCALE = 'en_US';
+ const DEFAULT_MAGENTO_CHARSET = 'UTF-8';
+ const DEFAULT_OSC_CHARSET = 'ISO-8859-1';
+ const DEFAULT_FIELD_CHARSET = 'utf8';
+
+ protected $_currentWebsiteId;
+ protected $_currentWebsite;
+
+ protected $_importType = array();
+ protected $_countryIdToCode = array();
+ protected $_countryNameToCode = array();
+ protected $_regionCode = array();
+ protected $_logData = array();
+ protected $_languagesToStores = array();
+ protected $_prefix = '';
+ protected $_storeLocales = array();
+ protected $_rootCategory = '';
+
+ protected $_websiteCode = '';
+ protected $_isProductWithCategories = false;
+ protected $_setupConnection ;
+ protected $_customerIdPair = array();
+ protected $_categoryIdPair = array();
+ protected $_prefixPath = '';
+ protected $_stores = array();
+ protected $_productsToCategories = array();
+ protected $_productsToStores = array();
+ protected $_connectionCharset;
+ protected $_dataCharset;
+ protected $_maxRows;
+ protected $_oscStores;
+ protected $_oscDefaultLanguage;
+ protected $_oscStoreInformation;
+ protected $_categoryModel;
+ protected $_customerModel;
+ protected $_productModel;
+ protected $_productAdapterModel;
+ protected $_orderModel;
+ protected $_addressModel;
+ protected $_websiteModel;
+ protected $_storeGroupModel;
+ protected $_configModel;
+ protected $_customerGroupModel;
+ protected $_storeModel;
+ protected $_importCollection;
+ protected $_saveRows = 0;
+ protected $_errors = array();
+ protected $_importModel;
+ protected $_lengthShortDescription;
+ protected $_currentUserId;
+
+ protected $_oscTables = array(
+ 'products', 'customers', 'categories', 'orders', 'languages',
+ 'orders_products', 'orders_status_history', 'orders_total',
+ 'products_description', 'address_book', 'categories_description'
+ );
+
+ protected function _construct()
+ {
+ $this->_init('oscommerce/oscommerce', 'import_id');
+ $this->_setupConnection = Mage::getSingleton('core/resource')->getConnection('oscommerce_setup');
+ $this->_currentWebsite = Mage::app()->getWebsite();
+ $this->_currentWebsiteId = $this->_currentWebsite->getId();
+ $this->_maxRows = Mage::getStoreConfig('oscommerce/import/max_rows');
+ $this->_lengthShortDescription = Mage::getStoreConfig('oscommerce/import/short_description_length');
+ }
+
+ /**
+ * Get paypal session namespace
+ *
+ * @return Mage_Paypal_Model_Session
+ */
+ public function getSession()
+ {
+ return Mage::getSingleton('oscommerce/session');
+ }
+
+ /**
+ * Get website object
+ *
+ * @return Mage_Core_Model_Website
+ */
+ public function getCurrentWebsite()
+ {
+ return $this->_currentWebsite;
+ }
+
+ protected function _beforeSave(Mage_Core_Model_Abstract $object)
+ {
+ if (!$object->getCreatedAt()) {
+ $object->setCreatedAt($this->formatDate(time()));
+ }
+ $object->setUpdatedAt($this->formatDate(time()));
+ parent::_beforeSave($object);
+ }
+
+ /**
+ * Getting external connection adapter
+ *
+ * @return object
+ */
+ protected function _getForeignAdapter()
+ {
+ return $this->_getConnection('foreign');
+ }
+
+ /**
+ * Get store code by id
+ *
+ * @param integer $id
+ * @return string
+ */
+ public function getStoreCodeById($id)
+ {
+ if (!$this->_stores) {
+ $stores = Mage::app()->getStores();
+ foreach($stores as $store) {
+ $this->_stores[$store->getId()] = $store->getCode();
+ }
+ }
+ if (isset($this->_stores[$id])) {
+ return $this->_stores[$id];
+ }
+ return false;
+ }
+
+ public function setWebsiteCode($code)
+ {
+ if (isset($code)) $this->_websiteCode = $code;
+ }
+
+ /**
+ * Create new website or set current website as default website
+ *
+ * @param integer $websiteId
+ */
+ public function createWebsite($websiteId = null)
+ {
+ $importModel = $this->getImportModel();
+ $websiteModel = $this->getWebsiteModel();
+ if (!is_null($websiteId)) {
+ $websiteModel->load($websiteId);
+ }
+
+ if (!$websiteModel->getId()) {
+ $storeInfo = $this->getOscStoreInformation();
+ if ($this->_websiteCode && !($websiteModel->load($this->_websiteCode)->getId())) {
+ $websiteModel->setName($storeInfo['STORE_NAME']);
+ $websiteModel->setCode($this->_websiteCode ? $this->_websiteCode : $this->_format($storeInfo['STORE_NAME']));
+ $websiteModel->save();
+ }
+ }
+
+
+ if ($websiteModel->getId()) {
+ $this->saveLogs(array( 0 => $websiteModel->getId()), 'website');
+ }
+
+ /**
+ * Create Root category
+ */
+ $this->createRootCategory();
+
+ /**
+ * Create default store group
+ */
+ $this->createStoreGroup();
+ }
+
+ public function createStoreGroup()
+ {
+ $importModel = $this->getImportModel();
+ $storeInfo = $this->getOscStoreInformation();
+ $websiteModel = $this->getWebsiteModel();
+ if (!$websiteModel->getId()) {
+ $websiteModel->load($this->_currentWebsiteId); // NEED TO GET DEFAULT WEBSITE ID FROM CONFIG
+ }
+ $storeGroupModel = $this->getStoreGroupModel();
+ $storeGroupModel->unsetData();
+ $storeGroupModel->setOrigData();
+
+ $storeGroupName = Mage::helper('oscommerce')->__('%s Store', $websiteModel->getId() == $this->_currentWebsiteId ? $storeInfo['STORE_NAME'] : $websiteModel->getName());
+ $storeGroupModel->setWebsiteId($websiteModel->getId());
+ $storeGroupModel->setName($storeGroupName);
+ $storeGroupModel->setRootCategoryId($this->getRootCategory()->getId());
+
+ try {
+ $storeGroupModel->save();
+
+ $websiteModel->setDefaultGroupId($storeGroupModel->getId());
+ $websiteModel->save();
+ }
+ catch (Exception $e) {
+
+ }
+
+ $this->saveLogs(array(0 => $storeGroupModel->getId(), 'group'));
+ return $this;
+ }
+
+ public function createRootCategory()
+ {
+ $importModel = $this->getImportModel();
+ $categoryModel = $this->getCategoryModel();
+ $categoryModel->unsetData();
+ $categoryModel->setOrigData();
+
+ $websiteModel = $this->getWebsiteModel();
+ if (!$websiteModel->getId()) {
+ $websiteModel->load($this->_currentWebsiteId); // NEED TO GET DEFAULT WEBSITE ID FROM CONFIG
+ }
+
+ $storeInfo = $this->getOscStoreInformation();
+
+ $categoryName = Mage::helper('oscommerce')->__('Root category for %s', $websiteModel->getName());
+
+ $categoryModel->setStoreId(0);
+ $categoryModel->setIsActive(1);
+ $categoryModel->setDisplayMode(self::DEFAULT_DISPLAY_MODE);
+ $categoryModel->setName($categoryName);
+ $categoryModel->setParentId(1);
+ $categoryModel->setPath('1');
+
+ try {
+ $categoryModel->save();
+ $this->saveLogs(array(0 => $categoryModel->getId()), 'root_category');
+ }
+ catch (Exception $e) {
+
+ }
+
+ $this->setRootCategory(clone $categoryModel);
+
+ return $this;
+ }
+
+ /**
+ * Importing store data from osCommerce to Magento
+ *
+ * @param Mage_Oscommerce_Model_Oscommerce $obj
+ */
+ public function importStores()
+ {
+ $importModel = $this->getImportModel();
+ $locales = $this->getStoreLocales();
+ $defaultStore = '';
+ $storeInformation = $this->getOscStoreInformation();
+ $defaultStoreCode = $storeInformation['DEFAULT_LANGUAGE'];
+ $configModel = $this->getConfigModel();
+ $storeModel = $this->getStoreModel();
+ $storeGroupModel = $this->getStoreGroupModel();
+ $storeGroupId = $storeGroupModel->getId();
+ $websiteModel = $this->getWebsiteModel();
+ $websiteId = $websiteModel->getId();
+ $storePairs = array();
+ if ($stores = $this->getOscStores()) {
+ foreach($stores as $store) {
+ try {
+ $oscStoreId = $store['id'];
+ unset($store['id']);
+
+ $store['group_id'] = $storeGroupId;
+ $store['website_id'] = $websiteId;
+ $storeModel->unsetData();
+ $storeModel->setOrigData();
+ $storeModel->load($store['code']);
+ if ($storeModel->getId() && $storeModel->getCode() == $store['code']) {
+ $localeCode = $locales[$store['code']];
+ unset($locales[$store['code']]);
+ $store['code'] = $store['code'].'_'.$websiteId.time(); // for unique store code
+ $locales[$store['code']] = $localeCode;
+ }
+ $store['name'] = $this->convert($store['name']);
+ $storeModel->unsetData();
+ $storeModel->setOrigData();
+ $storeModel->setData($store);
+ $storeModel->save();
+
+ $storePairs[$oscStoreId] = $storeModel->getId();
+
+ $storeLocale = isset($locales[$storeModel->getCode()])?$locales[$storeModel->getCode()]: $locales['default'];
+
+ $configModel->unsetData();
+ $configModel->setOrigData();
+ $configModel->setScope('stores')
+ ->setScopeId($storeModel->getId())
+ ->setPath('general/locale/code')
+ ->setValue($storeLocale)
+ ->save();
+ if ($store['scode'] == $defaultStoreCode) {
+ $defaultStore = $storeModel->getId();
+ }
+ Mage::dispatchEvent('store_add', array('store'=>$storeModel));
+ } catch (Exception $e) {
+ //echo $e->getMessage();
+ }
+ }
+ }
+ if (sizeof($storePairs) > 0) {
+ $this->saveLogs($storePairs, 'store');
+ }
+ $this->setStoreLocales($locales);
+
+ if ($defaultStore) {
+ $storeGroupModel->setDefaultStoreId($defaultStore);
+ $storeGroupModel->save();
+ }
+ Mage::app()->reinitStores();
+ unset($stores);
+ }
+
+ /**
+ * Importing customer/address from osCommerce to Magento
+ *
+ * @param Mage_Oscommerce_Model_Oscommerce $obj
+ */
+ public function importCustomers($startFrom = 0, $useStartFrom = false, $sendSubscription = true)
+ {
+ $this->_resetSaveRows();
+ $this->_resetErrors();
+ $totalCustomers = $this->getTotalCustomers();
+ $maxRows = $this->getMaxRows();
+ $pages = floor($totalCustomers / $maxRows) + 1;
+
+ if (!$useStartFrom) {
+ for ($i = 0; $i < $pages; $i++) {
+ if ($customers = $this->getCustomers(array('from'=>($i * $maxRows),'max'=>$maxRows))) {
+ foreach ($customers as $customer) {
+ $customer['sendSubscription'] = $sendSubscription;
+ $this->_saveCustomer($customer);
+ }
+ }
+ }
+ } else {
+ if ($customers = $this->getCustomers(array('from'=> $startFrom ,'max'=>$maxRows))) {
+ foreach ($customers as $customer) {
+ $customer['sendSubscription'] = $sendSubscription;
+ $this->_saveCustomer($customer);
+ }
+ }
+ }
+ }
+
+ /**
+ * Save customer data
+ *
+ * @param Mage_Oscommerce_Model_Oscommerce $obj
+ * @param array $data
+ */
+ protected function _saveCustomer($data = null) {
+ $addressFieldMapping = array(
+ 'street' => 'entry_street_address',
+ 'firstname' => 'entry_firstname',
+ 'lastname' => 'entry_lastname',
+ 'city' => 'entry_city',
+ 'region' => 'entry_state'
+ );
+ $importModel = $this->getImportModel();
+ $timezone = $importModel->getTimezone();
+ if (!is_null($data)) {
+ $customerAddresses = array();
+ // Getting customer group data
+ $customerGroupId = Mage::getStoreConfig(Mage_Customer_Model_Group::XML_PATH_DEFAULT_ID);
+ $customerGroupModel = $this->getCustomerGroupModel()->load($customerGroupId);
+ $websiteId = $this->getWebsiteModel()->getId();
+ $customerModel = $this->getCustomerModel();
+ $addressModel = $this->getAddressModel();
+ $oscCustomerId = $data['id'];
+ $data['group_id'] = $customerGroupModel->getName();
+
+ $prepareCreated = explode(' ', $data['created_at']);
+ $dateFormat = 'YYYY-MM-dd HH:mm:ss';
+ $dateCreated = new Zend_Date();
+ $dateCreated->setTimezone($timezone);
+ $dateCreated->setDate($prepareCreated[0], 'YYYY-MM-dd');
+ $dateCreated->setTime($prepareCreated[1], 'HH:mm:ss');
+ $dateCreated->setTimezone('GMT');
+ $data['created_at'] = $dateCreated->toString($dateFormat);
+
+ foreach($data as $field => $value) {
+ if (in_array($field, array('firstname', 'lastname'))) {
+ $value = $this->convert($value);
+ }
+ $data[$field] = html_entity_decode($value, ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET);
+
+ }
+
+
+ // Getting addresses
+ $addresses = $this->getAddresses($data['id']);
+ if ($addresses) {
+ foreach ($addresses as $address) {
+ foreach ($address as $field => $value) {
+
+ if ($field == 'street1') {
+ $field = 'street';
+ }
+ if ($field == 'country_id') {
+ $value = $this->getCountryCodeById($value);
+ $field = 'country';
+ }
+ if ($field == 'region_id'
+ && in_array($address['country_id'], array(38, 223))) {
+ $field = 'region';
+ }
+
+ if (in_array($field, array_keys($addressFieldMapping))) {
+ $value = $this->convert($value);
+ }
+
+ if (!in_array($field, array('customers_id'))) {
+ $address[$field] = $value;
+ } else {
+ unset($address[$field]);
+ }
+ }
+ $address['country_id'] = $address['country'];
+ unset($address['country']);
+ $customerAddresses[] = $address;
+ }
+ }
+ $defaultBilling = '';
+ $defaultBilling = $data['default_billing'];
+ unset($data['default_billing']);
+ unset($data['id']);
+
+ try {
+ $customerModel->setData($data);
+ $customerModel->setImportMode(true);
+ $customerModel->setWebsiteId($websiteId > 0 ? $websiteId: $this->getCurrentWebsite()->getId());
+ $customerModel->save();
+ $customerId = $customerModel->getId();
+
+ if ($customerAddresses) foreach ($customerAddresses as $customerAddress) {
+ $customerAddress['telephone'] = $data['telephone'];
+ $customerAddress['fax'] = $data['fax'];
+ $addressModel->unsetData();
+ $addressModel->setData($customerAddress);
+ $addressModel->setCustomerId($customerId);
+ $addressModel->setId(null);
+ $addressModel->save();
+ if ($defaultBilling == $customerAddress['id']) {
+ $addressId = $addressModel->getId();
+ $customerModel->setDefaultBilling($addressId);
+ $customerModel->setDefaultShipping($addressId);
+ }
+ }
+ $customerModel->save();
+ $this->saveLogs(array($oscCustomerId => $customerId), 'customer');
+ $this->_saveRows++;
+ } catch (Exception $e) {
+ $this->_addErrors(Mage::helper('oscommerce')->__('Email %s cannot be saved because of %s', $data['email'], $e->getMessage()));
+ }
+ }
+ }
+
+ public function getCustomerIdPair()
+ {
+ if (!$this->_customerIdPair) {
+ $this->_customerIdPair = $this->getLogPairsByTypeCode('customer');
+ }
+ return $this->_customerIdPair;
+ }
+
+ public function setCustomerIdPair($data)
+ {
+ if (is_array($data)) {
+ $this->_customerIdPair = $data;
+ }
+ }
+
+ public function importCategories($startFrom = 0, $useStartFrom = false)
+ {
+ $importModel = $this->getImportModel();
+ $this->_logData['type_id'] = $this->getImportTypeIdByCode('category');
+ $this->_logData['import_id'] = $importModel->getId();
+ $categoryModel = $this->getCategoryModel();
+
+ $this->_resetSaveRows();
+ $this->_resetErrors();
+ $maxRows = $this->getMaxRows();
+ $totalCategories = $this->getCategoriesCount();
+
+ $pages = floor($totalCategories / $maxRows) + 1;
+ if (!$useStartFrom) {
+ for ($i = 0; $i < $pages; $i++) {
+ if ($categories = $this->getCategories(array('from'=> $i * $maxRows,'max'=>$maxRows))) {
+ foreach ($categories as $category) {
+ $this->_saveCategory($category);
+ }
+ }
+ }
+ } else {
+ if ($categories = $this->getCategories(array('from'=> $startFrom ,'max'=>$maxRows))) {
+ foreach ($categories as $category) {
+ $this->_saveCategory($category);
+ }
+ }
+ }
+ }
+
+ protected function _saveCategory($data) {
+ $importModel = $this->getImportModel();
+ $categoryModel = $this->getCategoryModel();
+ $oscCategoryId = $data['id'];
+ unset($data['id']);
+ try {
+ $data['store_id'] = 0;
+ $data['is_active'] = 1;
+ $data['display_mode'] = self::DEFAULT_DISPLAY_MODE;
+ $data['is_anchor'] = self::DEFAULT_IS_ANCHOR;
+ $data['attribute_set_id'] = $categoryModel->getDefaultAttributeSetId();
+ $data['name'] = $this->convert($data['name']);
+ $data['meta_title'] = html_entity_decode($data['name'], ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET);
+ $categoryModel->setData($data);
+ $categoryModel->save();
+ $categoryId = $categoryModel->getId();
+ $this->saveLogs(array($oscCategoryId => $categoryId), 'category');
+
+ // saving data for different (encoding has been done in getCategoryToStores method)
+ $storeData = $data['stores'];
+ unset($data['stores']);
+ if (isset($storeData)) {
+ foreach($storeData as $storeId=>$catData) {
+ $categoryModel->setStoreId($storeId)->setName($catData['name'])->setMetaTitle($catData['name'])
+ ->save();
+ }
+ }
+ $this->_saveRows++;
+ } catch (Exception $e) {
+ $this->_addErrors(Mage::helper('oscommerce')->__('Category %s cannot be saved because of %s', $data['name'], $e->getMessage()));
+ }
+ }
+
+
+
+ public function buildCategoryPath()
+ {
+ $categoryIdPair = $this->getCategoryIdPair();
+ $importModel = $this->getImportModel();
+ if ($categoryIdPair) foreach ($categoryIdPair as $oscommerceId => $magentoId) {
+ $path = $this->getRootCategory()->getPath().'/'.join('/',$this->getCategoryPath($oscommerceId));
+ $this->_getWriteAdapter()->raw_query("UPDATE `{$this->getTable('catalog_category')}` SET `path`='{$path}' WHERE `entity_id`={$magentoId}");
+ }
+ }
+
+ public function getCategoryPath($categoryId)
+ {
+ $categoryIdPair = $this->getCategoryIdPair();
+ $select = "SELECT `c`.`parent_id` FROM `{$this->getOscTable('categories')}` c ";
+ $select .= " WHERE `c`.`categories_id`={$categoryId}";
+ if ($parentId = $this->_getForeignAdapter()->fetchOne($select)) {
+ if ($result = $this->getCategoryPath($parentId)) {
+ if (!isset($results)) {
+ $results = $result;
+ } else {
+ array_merge($results, $result);
+ }
+ } else {
+ $results[] = $categoryIdPair[$parentId];
+ }
+ }
+ $results[] = $categoryIdPair[$categoryId];
+ return $results;
+ }
+
+ public function getCategoryIdPair()
+ {
+ if (!$this->_categoryIdPair) {
+ $this->_categoryIdPair = $this->getLogPairsByTypeCode('category');
+ }
+ return $this->_categoryIdPair;
+ }
+
+ public function setCategoryIdPair($data)
+ {
+ if (is_array($data)) {
+ $this->_categoryIdPair = $data;
+ }
+ }
+
+ /**
+ * Import products
+ *
+ * @param Mage_Oscommerce_Model_Oscommerce $obj
+ */
+ public function importProducts($startFrom = 0, $useStartFrom = false)
+ {
+ $importModel = $this->getImportModel();
+ $productAdapterModel = Mage::getModel('catalog/convert_adapter_product');
+ $productModel = $this->getProductModel();
+ $taxCollections = $this->_getTaxCollections();
+ $this->_resetSaveRows();
+ $this->_resetErrors();
+ $maxRows = $this->getMaxRows();
+ $totalProducts = $this->getProductsCount();
+ $pages = floor($totalProducts / $maxRows) + 1;
+ if (!$useStartFrom) {
+ for ($i = 0; $i < $pages; $i++) {
+ if ($products = $this->getProducts(array('from'=> $i * $maxRows,'max'=>$maxRows))) {
+ foreach ($products as $product) {
+ if (!empty($product['tax_class_id'])) {
+ $product['tax_class_id'] = $taxCollections[$product['tax_class_id']];
+ }
+ $this->_saveProduct($product);
+ }
+ }
+ }
+ } else {
+ if ($products = $this->getProducts(array('from'=> $startFrom ,'max'=>$maxRows))) {
+ foreach ($products as $product) {
+ if (!empty($product['tax_class_id'])) {
+ $product['tax_class_id'] = $taxCollections[$product['tax_class_id']];
+ }
+ $this->_saveProduct($product);
+ }
+ }
+ }
+ }
+
+ /**
+ * Save products data
+ *
+ * @param Mage_Oscommerce_Model_Oscommerce $obj
+ * @param array $data
+ */
+ protected function _saveProduct($data) {
+ $importModel = $this->getImportModel();
+ $productAdapterModel = $this->getProductAdapterModel();
+ $productModel = $this->getProductModel();
+ $mageStores = $this->getLanguagesToStores();
+ $storeInfo = $this->getOscStoreInformation();
+ $storeName = $storeInfo['STORE_NAME'];
+ $oscProductId = $data['id'];
+ unset($data['id']);
+ if ($this->_isProductWithCategories) {
+ if ($categories = $this->getProductCategories($oscProductId))
+ $data['category_ids'] = $categories;
+ }
+
+ /**
+ * Checking product by using sku and website
+ */
+ if (empty($data['sku'])) {
+ $data['sku'] = $storeName . ' - ' . $oscProductId;
+ }
+ $productModel->unsetData();
+ $productId = $productModel->getIdBySku($data['sku']);
+ $productModel->load($productId);
+ if ($productModel->getId()) {
+ $websiteIds = $productModel->getWebsiteIds();
+
+ if ($websiteIds) foreach($websiteIds as $websiteId) {
+ if ($websiteId == $this->getWebsiteModel()->getId()) {
+ $this->_addErrors(Mage::helper('oscommerce')->__('SKU %s was not imported since it already exists in %s',
+ $data['sku'],
+ $this->getWebsiteModel()->getName()));
+ return ;
+ }
+ }
+ }
+ try {
+ if (isset($data['image'])) {
+ if (substr($data['image'], 0,1) != DS) {
+ $data['image'] = DS . $data['image'];
+ }
+
+ if (!file_exists(Mage::getBaseDir('media'). DS . 'import' . $data['image'])) {
+ unset($data['image']);
+ } else {
+ $data['thumbnail'] = $data['small_image'] = $data['image'];
+ }
+ }
+ if ($stores = $this->getProductStores($oscProductId)) {
+
+ foreach ($stores as $storeId => $store) {
+ if (!$storeCode = $this->getStoreCodeById($mageStores[$storeId])) {
+ $storeCode = $this->getCurrentWebsite()->getDefaultStore()->getCode();
+ }
+ $data['store'] = $storeCode;
+ $data['name'] = html_entity_decode($this->convert($store['name']), ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET);
+ $data['description'] = html_entity_decode($this->convert($store['description']), ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET);
+ $data['short_description'] = $data['description'];
+ $productAdapterModel->saveRow($data);
+ }
+ }
+
+ $productId = $productAdapterModel->getProductModel()->getId();
+ $this->saveLogs(array($oscProductId => $productId), 'product');
+ $this->_saveRows++;
+ } catch (Exception $e) {
+ $this->_addErrors(Mage::helper('oscommerce')->__('SKU %s cannot be saved because of %s', $data['sku'], $e->getMessage()));
+ }
+ }
+
+ public function importOrders($startFrom = 0, $useStartFrom = false)
+ {
+ $importModel = $this->getImportModel();
+ $this->_resetSaveRows();
+ $this->_resetErrors();
+ // Get orders
+
+ $totalOrders = $this->getOrdersCount();
+ $maxRows = $this->getMaxRows();
+ $pages = floor($totalOrders / $maxRows) + 1;
+
+ if (!$useStartFrom) {
+ for ($i = 0; $i < $pages; $i++) {
+ $orders = $this->getOrders(array('from' => $i * $maxRows, 'max' => $maxRows));
+ if ($orders) foreach($orders as $order) {
+ $this->_saveOrder($order);
+ }
+ }
+ } else {
+ $orders = $this->getOrders(array('from' => $startFrom, 'max' => $maxRows));
+ if ($orders) foreach($orders as $order) {
+ $this->_saveOrder($order);
+ }
+ }
+ }
+
+ public function createOrderTables()
+ {
+ $importModel = $this->getImportModel();
+ $importId = $importModel->getId();
+ $websiteId = $this->getWebsiteModel()->getId();
+
+ $tables = array(
+ 'orders' => "CREATE TABLE `{$this->getTable('oscommerce_order')}` (
+ `osc_magento_id` int(11) NOT NULL auto_increment,
+ `orders_id` int(11) NOT NULL default '0',
+ `customers_id` int(11) NOT NULL default '0',
+ `magento_customers_id` int(11) NOT NULL default '0',
+ `import_id` int(11) NOT NULL default '0',
+ `website_id` int(11) NOT NULL default '0',
+ `customers_name` varchar(64) NOT NULL default '',
+ `customers_company` varchar(32) default NULL,
+ `customers_street_address` varchar(64) NOT NULL default '',
+ `customers_suburb` varchar(32) default NULL,
+ `customers_city` varchar(32) NOT NULL default '',
+ `customers_postcode` varchar(10) NOT NULL default '',
+ `customers_state` varchar(32) default NULL,
+ `customers_country` varchar(32) NOT NULL default '',
+ `customers_telephone` varchar(32) NOT NULL default '',
+ `customers_email_address` varchar(96) NOT NULL default '',
+ `customers_address_format_id` int(5) NOT NULL default '0',
+ `delivery_name` varchar(64) NOT NULL default '',
+ `delivery_company` varchar(32) default NULL,
+ `delivery_street_address` varchar(64) NOT NULL default '',
+ `delivery_suburb` varchar(32) default NULL,
+ `delivery_city` varchar(32) NOT NULL default '',
+ `delivery_postcode` varchar(10) NOT NULL default '',
+ `delivery_state` varchar(32) default NULL,
+ `delivery_country` varchar(32) NOT NULL default '',
+ `delivery_address_format_id` int(5) NOT NULL default '0',
+ `billing_name` varchar(64) NOT NULL default '',
+ `billing_company` varchar(32) default NULL,
+ `billing_street_address` varchar(64) NOT NULL default '',
+ `billing_suburb` varchar(32) default NULL,
+ `billing_city` varchar(32) NOT NULL default '',
+ `billing_postcode` varchar(10) NOT NULL default '',
+ `billing_state` varchar(32) default NULL,
+ `billing_country` varchar(32) NOT NULL default '',
+ `billing_address_format_id` int(5) NOT NULL default '0',
+ `payment_method` varchar(255) NOT NULL default '',
+ `cc_type` varchar(20) default NULL,
+ `cc_owner` varchar(64) default NULL,
+ `cc_number` varchar(32) default NULL,
+ `cc_expires` varchar(4) default NULL,
+ `last_modified` datetime default NULL,
+ `date_purchased` datetime default NULL,
+ `orders_status` varchar(32) default NULL,
+ `orders_date_finished` datetime default NULL,
+ `currency` varchar(3) default NULL,
+ `currency_value` decimal(14,6) default NULL,
+ `currency_symbol` varchar(3) default NULL,
+ `orders_total` decimal(14,6) default NULL,
+ PRIMARY KEY (`osc_magento_id`),
+ KEY `idx_orders_customers_id` (`customers_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ "
+ , 'orders_products' => "CREATE TABLE `{$this->getTable('oscommerce_order_products')}` (
+ `orders_products_id` int(11) NOT NULL auto_increment,
+ `osc_magento_id` int(11) NOT NULL default '0',
+ `products_id` int(11) NOT NULL default '0',
+ `products_model` varchar(12) default NULL,
+ `products_name` varchar(64) NOT NULL default '',
+ `products_price` decimal(15,4) NOT NULL default '0.0000',
+ `final_price` decimal(15,4) NOT NULL default '0.0000',
+ `products_tax` decimal(7,4) NOT NULL default '0.0000',
+ `products_quantity` int(2) NOT NULL default '0',
+ PRIMARY KEY (`orders_products_id`),
+ KEY `idx_orders_products_osc_magento_id` (`osc_magento_id`),
+ KEY `idx_orders_products_products_id` (`products_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+ "
+
+ , 'orders_total' => "CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_order_total')}` (
+ `orders_total_id` int(10) unsigned NOT NULL auto_increment,
+ `osc_magento_id` int(11) NOT NULL default '0',
+ `title` varchar(255) NOT NULL default '',
+ `text` varchar(255) NOT NULL default '',
+ `value` decimal(15,4) NOT NULL default '0.0000',
+ `class` varchar(32) NOT NULL default '',
+ `sort_order` int(11) NOT NULL default '0',
+ PRIMARY KEY (`orders_total_id`),
+ KEY `idx_orders_total_osc_magento_id` (`osc_magento_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
+
+ , 'orders_status_history'=>"CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_order_history')}` (
+ `orders_status_history_id` int(11) NOT NULL auto_increment,
+ `osc_magento_id` int(11) NOT NULL default '0',
+ `orders_status_id` int(5) NOT NULL default '0',
+ `date_added` datetime NOT NULL default '0000-00-00 00:00:00',
+ `customer_notified` int(1) default '0',
+ `comments` text,
+ `orders_status` varchar(32) default NULL,
+ PRIMARY KEY (`orders_status_history_id`),
+ KEY `idx_orders_status_history_osc_magento_id` (`osc_magento_id`)
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"
+
+ );
+
+ $conn = $this->_setupConnection;
+ foreach ($tables as $table => $schema) {
+ $conn->beginTransaction();
+ try {
+ $conn->query($schema);
+ $conn->commit();
+ } catch (Exception $e) {
+// $conn->rollBack();
+ }
+ }
+
+ $this->checkOrderField();
+ }
+
+ public function setTablePrefix($prefix)
+ {
+ if (isset($prefix)) $this->_prefix = $prefix;
+ }
+
+ public function getTablePrefix()
+ {
+ return $this->_prefix;
+ }
+
+ public function setIsProductWithCategories($yn)
+ {
+ if (is_bool($yn)) {
+ $this->_isProductWithCategories = $yn;
+ }
+ }
+
+ /**
+ * Logging imported data to oscommerce_ref table
+ *
+ * @param array data
+ */
+ public function log($data = array())
+ {
+ if (isset($data)) {
+ $this->_getWriteAdapter()->beginTransaction();
+ try {
+ $this->_getWriteAdapter()->insert($this->getTable('oscommerce_ref'), $data);
+ $this->_getWriteAdapter()->commit();
+ } catch (Exception $e) {
+ $this->_getWriteAdapter()->rollBack();
+ }
+ }
+ }
+
+ public function getOscStoreInformation()
+ {
+ if (!$this->_oscStoreInformation) {
+ $select = "SELECT `configuration_key` `key`, `configuration_value` `value` FROM `{$this->getOscTable('configuration')}`";
+ $select .= " WHERE `configuration_key` IN ('STORE_NAME', 'STORE_OWNER', 'STORE_OWNER_EMAIL', 'STORE_COUNTRY',' STORE_ZONE','DEFAULT_LANGUAGE')";
+ if (!($result = $this->_getForeignAdapter()->fetchPairs($select))) {
+ $result = array();
+ }
+ $this->_oscStoreInformation = $result;
+ }
+ return $this->_oscStoreInformation;
+ }
+
+ /**
+ * Getting products data from osCommerce
+ *
+ */
+ public function getProducts($limit = array())
+ {
+ $defaultLanguage = $this->getOscDefaultLanguage();
+ $defaultLanguageId = $defaultLanguage['id'];
+ $code = $this->getWebsiteModel()->getCode();
+ $website = $code? $code: $this->getCurrentWebsite()->getCode();
+ $connection = $this->_getForeignAdapter();
+ $select = " SELECT `p`.`products_id` `id`, `p`.`products_quantity` `qty` ";
+ $select .= " , `p`.`products_model` `sku`, `p`.`products_price` `price`";
+ $select .= " , `p`.`products_image` `image` ";
+ $select .= " , `p`.`products_weight` `weight`, IF(`p`.`products_status`,'Enabled','Disabled') `status` ";
+ $select .= " , IF(`p`.`products_status`,'1','0') `is_in_stock`";
+ $select .= " , `pd`.`products_name` `name`, `pd`.`products_description` `description` ";
+// $select .= " , `tc`.`tax_class_title` `tax_class_id`, IF(1,'".self::DEFAULT_VISIBILITY."','') `visibility` ";
+ $select .= " , `p`.`products_tax_class_id` `tax_class_id`, IF(1,'".self::DEFAULT_VISIBILITY."','') `visibility` ";
+ $select .= " , `sp`.`specials_new_products_price` `special_price` ";
+ $select .= " , `sp`.`specials_date_added` `special_from_date` ";
+ $select .= " , `sp`.`expires_date` `special_to_date` ";
+ $select .= " , IF(1,'".self::DEFAULT_ATTRIBUTE_SET."','') `attribute_set` ";
+ $select .= " , IF(1,'".self::DEFAULT_PRODUCT_TYPE ."','') `type` ";
+ //$select .= ", IF(1,'".self::DEFAULT_STORE."','') `store` ";
+ $select .= " , IF(1,'".$website."','') `website` ";
+ $select .= " FROM `{$this->getOscTable('products')}` p LEFT JOIN `{$this->getOscTable('products_description')}` pd ";
+ $select .= " ON `pd`.`products_id`=`p`.`products_id` AND `pd`.`language_id`={$defaultLanguageId} ";
+// $select .= " LEFT JOIN `{$this->getOscTable('tax_class')}` tc ON `tc`.`tax_class_id`=`p`.`products_tax_class_id` ";
+ $select .= " LEFT JOIN `{$this->getOscTable('specials')}` sp ON `sp`.`products_id`=`p`.`products_id` ";
+ if ($limit && isset($limit['from']) && isset($limit['max'])) {
+ $select .= " LIMIT {$limit['from']}, {$limit['max']}";
+ }
+ if (!($result = $this->_getForeignAdapter()->fetchAll($select))) {
+ $result = array();
+ }
+ return $result;
+ }
+
+ public function getProductsCount()
+ {
+ return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('products')}`");
+ }
+
+ public function getCategoriesCount()
+ {
+ return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('categories')}`");
+ }
+
+ public function getCustomersCount()
+ {
+ return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('customers')}`");
+ }
+
+ public function getOrdersCount()
+ {
+ return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('orders')}`");
+ }
+
+ public function getOrders($limit = array()) {
+ $defaultLanguage = $this->getOscDefaultLanguage();
+ $defaultLanguageId = $defaultLanguage['id'];
+ $select = "SELECT `o`.`orders_id`, `o`.`customers_id`, `o`.`customers_name`";
+ $select .= " ,`o`.`customers_company`,`o`.`customers_street_address`";
+ $select .= " ,`o`.`customers_suburb`, `o`.`customers_city`";
+ $select .= " ,`o`.`customers_postcode`, `o`.`customers_state`";
+ $select .= " ,`o`.`customers_country`, `o`.`customers_telephone`";
+ $select .= " ,`o`.`customers_email_address`, `o`.`customers_address_format_id`";
+ $select .= " ,`o`.`delivery_name`, `o`.`delivery_company`";
+ $select .= " ,`o`.`delivery_street_address`, `o`.`delivery_suburb`";
+ $select .= " ,`o`.`delivery_city`, `o`.`delivery_postcode`, `o`.`delivery_state`";
+ $select .= " ,`o`.`delivery_country`, `o`.`delivery_address_format_id`";
+ $select .= " ,`o`.`billing_name`, `o`.`billing_company`";
+ $select .= " ,`o`.`billing_street_address`, `o`.`billing_suburb`";
+ $select .= " ,`o`.`billing_city`, `o`.`billing_postcode`, `o`.`billing_state`";
+ $select .= " ,`o`.`billing_country`, `o`.`billing_address_format_id`";
+ $select .= " ,`o`.`payment_method`, `o`.`cc_type`, `o`.`cc_owner`, `o`.`cc_number`";
+ $select .= " ,`o`.`cc_expires`, `o`.`last_modified`, `o`.`date_purchased`";
+ $select .= " ,`o`.`orders_status`, `o`.`orders_date_finished`, `o`.`currency`, `o`.`currency_value`";
+ $select .= " ,`c`.`symbol_left` `currency_symbol`,`ot`.`value` `orders_total`";
+ $select .= " ,`os`.`orders_status_name` FROM `{$this->getOscTable('orders')}` `o`";
+ $select .= " LEFT JOIN `{$this->getOscTable('currencies')}` `c` ON `c`.`code`=`o`.`currency` ";
+ $select .= " LEFT JOIN `{$this->getOscTable('orders_total')}` `ot` ON `ot`.`orders_id`=`o`.`orders_id` ";
+ $select .= " AND `ot`.`class`='ot_total'";
+ $select .= " LEFT JOIN `{$this->getOscTable('orders_status')}` os ON `os`.`orders_status_id`=`o`.`orders_status` ";
+ $select .= " AND `os`.`language_id`={$defaultLanguageId} ";
+ if (isset($limit) && isset($limit['from']) && isset($limit['max'])) {
+ $select .= " LIMIT {$limit['from']}, {$limit['max']} ";
+ }
+ if (!($result = $this->_getForeignAdapter()->fetchAll($select))) {
+ $result = array();
+ }
+ return $result;
+ }
+
+ protected function _saveOrder($data)
+ {
+ $fieldNoEnc = array(
+ 'customers_id',
+ 'orders_id',
+ 'date_purchased',
+ 'last_modified',
+ 'orders_date_finished',
+ 'orders_products_id',
+ 'osc_magento_id',
+ 'products_id'
+ );
+
+ $importModel = $this->getImportModel();
+ $timezone = $importModel->getTimezone();
+ $customerIdPair = $this->getCustomerIdPair();
+ $importId = $importModel->getId();
+ $websiteId = $this->getWebsiteModel()->getId();
+ if ($data['customers_id'] > 0 && isset($this->_customerIdPair[$data['customers_id']])) {
+ foreach($data as $field => $value) {
+ if (!in_array($field, $fieldNoEnc)) {
+ $data[$field] = $this->convert($value);
+ }
+ }
+
+ if ($data['date_purchased']) {
+ $preparePurchased = explode(' ', $data['date_purchased']);
+ $dateFormat = 'YYYY-MM-dd HH:mm:ss';
+ $datePurchased = new Zend_Date();
+ $datePurchased->setTimezone($timezone);
+ $datePurchased->setDate($preparePurchased[0], 'YYYY-MM-dd');
+ $datePurchased->setTime($preparePurchased[1], 'HH:mm:ss');
+ $datePurchased->setTimezone('GMT');
+ $data['date_purchased'] = $datePurchased->toString($dateFormat);
+ }
+
+ if ($data['last_modified']) {
+ $prepareModified = explode(' ', $data['last_modified']);
+ $dateModified = new Zend_Date();
+ $dateModified->setTimezone($timezone);
+ $dateModified->setDate($prepareModified[0], 'YYYY-MM-dd');
+ $dateModified->setTime($prepareModified[1], 'HH:mm:ss');
+ $dateModified->setTimezone('GMT');
+ $data['last_modified'] = $dateModified->toString($dateFormat);
+ }
+
+ if ($data['orders_date_finished']) {
+ $prepareFinished = explode(' ', $data['orders_date_finished']);
+ $dateFinished = new Zend_Date();
+ $dateFinished->setTimezone($timezone);
+ $dateFinished->setDate($prepareFinished[0], 'YYYY-MM-dd');
+ $dateFinished->setTime($prepareFinished[1], 'HH:mm:ss');
+ $dateFinished->setTimezone('GMT');
+ $data['orders_date_finished'] = $dateFinished->toString($dateFormat);
+ }
+
+ $data['magento_customers_id'] = $this->_customerIdPair[$data['customers_id']]; // get Magento CustomerId
+ $data['import_id'] = $importId;
+ $data['website_id'] = $websiteId;
+ $data['orders_status'] = $data['orders_status_name'];
+ unset($data['orders_status_name']);
+ $this->_getWriteAdapter()->insert($this->getTable('oscommerce_order'), $data);
+ $oscMagentoId = $this->_getWriteAdapter()->lastInsertId();
+ $this->_saveRows++;
+
+ // Get orders products
+ $select = "SELECT `orders_products_id`, `orders_id`, `products_id` ";
+ $select .= ", `products_model`, `products_name`, `products_price`, `final_price` ";
+ $select .= ", `products_tax`, `products_quantity` ";
+ $select .= " FROM `{$this->getOscTable('orders_products')}` WHERE `orders_id`={$data['orders_id']}";
+ if ($orderProducts = $this->_getForeignAdapter()->fetchAll($select)) {
+ foreach ($orderProducts as $orderProduct) {
+ unset($orderProduct['orders_id']);
+ unset($orderProduct['orders_products_id']);
+ $orderProduct['osc_magento_id'] = $oscMagentoId;
+ foreach ($orderProduct as $field => $value) {
+ if (!in_array($field, $fieldNoEnc)) {
+ $orderProduct[$field] = $this->convert($value);
+ }
+ }
+ $this->_getWriteAdapter()->insert($this->getTable('oscommerce_order_products'), $orderProduct);
+ }
+ }
+
+ // Get orders totals
+ $select = "SELECT `orders_total_id`, `orders_id`, `title`, `text`, `value`, `class`, `sort_order` ";
+ $select .= " FROM `{$this->getOscTable('orders_total')}` WHERE `orders_id`={$data['orders_id']} ORDER BY `sort_order`";
+
+ if ($orderTotals = $this->_getForeignAdapter()->fetchAll($select)) {
+ foreach ($orderTotals as $orderTotal) {
+
+ unset($orderTotal['orders_id']);
+ unset($orderTotal['orders_total_id']);
+ $orderTotal['osc_magento_id'] = $oscMagentoId;
+ $orderTotal['title'] = $this->convert($orderTotal['title']);
+ $orderTotal['text'] = $this->convert($orderTotal['text']);
+ $this->_getWriteAdapter()->insert($this->getTable('oscommerce_order_total'), $orderTotal);
+ }
+ }
+
+ $defaultLanguage = $this->getOscDefaultLanguage();
+ $defaultLanguageId = $defaultLanguage['id'];
+
+ // Get orders status history
+ $select = "SELECT `osh`.`orders_status_history_id`, `osh`.`orders_id`, `osh`.`orders_status_id` ";
+ $select .= ", `os`.`orders_status_name` `orders_status`, `osh`.`date_added`, `osh`.`customer_notified`, `osh`.`comments` ";
+ $select .= " FROM `{$this->getOscTable('orders_status_history')}` osh ";
+ $select .= " LEFT JOIN `{$this->getOscTable('orders_status')}` os ON `os`.`orders_status_id`=`osh`.`orders_status_id` ";
+ $select .= " AND `os`.`language_id`={$defaultLanguageId}";
+ $select .= " WHERE `osh`.`orders_id`={$data['orders_id']}";
+ if ($orderHistories = $this->_getForeignAdapter()->fetchAll($select)) {
+ foreach ($orderHistories as $orderHistory) {
+ unset($orderHistory['orders_id']);
+ unset($orderHistory['orders_status_history_id']);
+ $orderHistory['osc_magento_id'] = $oscMagentoId;
+ $prepareAdded = explode(' ', $orderHistory['date_added']);
+ $dateFormat = 'YYYY-MM-dd HH:mm:ss';
+ $dateAdded = new Zend_Date();
+ $dateAdded->setTimezone($timezone);
+ $dateAdded->setDate($prepareAdded[0], 'YYYY-MM-dd');
+ $dateAdded->setTime($prepareAdded[1], 'HH:mm:ss');
+ $dateAdded->setTimezone('GMT');
+ $orderHistory['date_added'] = $dateAdded->toString($dateFormat);
+ $orderHistory['orders_status'] = $this->convert($orderHistory['orders_status']);
+ $orderHistory['comments'] = $this->convert($orderHistory['comments']);
+ $orderHistory['customer_notified'] = $this->convert($orderHistory['customer_notified']);
+
+ $this->_getWriteAdapter()->insert($this->getTable('oscommerce_order_history'), $orderHistory);
+ }
+ }
+ } else {
+ $this->_addErrors(Mage::helper('oscommerce')->__('Order #%s failed to import because the customer ID #%s associated with this order could not be found.', $data['orders_id'], $data['customers_id']));
+ }
+ }
+
+ /**
+ * Getting product description for different stores
+ *
+ * @param integer $productId
+ * @return mix array/boolean
+ */
+ public function getProductStores($productId) {
+ if (!$this->_productsToStores) {
+ $select = "SELECT `products_id`, `language_id` `store`, `products_name` `name`, `products_description` `description`";
+ $select .= " FROM `{$this->getOscTable('products_description')}` ";
+ if ($results = $this->_getForeignAdapter()->fetchAll($select)) {
+ foreach ($results as $result) {
+ $this->_productsToStores[$result['products_id']][$result['store']] = array('name'=>$result['name'], 'description' => $result['description']);
+ }
+ }
+ }
+ if (isset($this->_productsToStores[$productId])) {
+ return $this->_productsToStores[$productId];
+ }
+ return false;
+ }
+
+ /**
+ * Getting new created categories recursively using products of osCommerce
+ *
+ * @param integer $productId
+ * @return string
+ */
+ public function getProductCategories($productId)
+ {
+ $importModel = $this->getImportModel();
+ if (!$this->_productsToCategories) {
+ $select = "SELECT `products_id`, `categories_id` FROM `{$this->getOscTable('products_to_categories')}`";
+
+ if ($results = $this->_getForeignAdapter()->fetchAll($select)) {
+ $categories = array();
+ foreach ($results as $result) {
+ $categories[$result['products_id']] = $result['categories_id'];
+ if (isset($categories[$result['products_id']])) {
+ $categories[$result['products_id']] .= ','.$result['categories_id'];
+ } else {
+ $categories[$result['products_id']] = $result['categories_id'];
+ }
+ }
+ //$categories = join(',', array_values($results));
+
+ //$this->_getReadAdapter();
+ $importId = $importModel->getId();
+ $typeId = $this->getImportTypeIdByCode('category');
+
+
+ if ($categories) foreach ($categories as $product => $category) {
+ $select = $this->_getReadAdapter()->select();
+ $select->from(array('osc'=>$this->getTable('oscommerce_ref')), array('id'=>'id','ref_id'=>'ref_id'));
+ $select->where("`osc`.`import_id`='{$importId}' AND `osc`.`type_id`='{$typeId}' AND `osc`.`value` in (".$category.")");
+ $resultCategories = $this->_getReadAdapter()->fetchPairs($select);
+ if ($resultCategories) {
+ $this->_productsToCategories[$product] = join(',',array_values($resultCategories));
+ }
+ }
+ }
+ }
+ if (isset($this->_productsToCategories[$productId])) {
+ return $this->_productsToCategories[$productId];
+ }
+ return false;
+ }
+
+ public function getCategories($limit = array()) {
+ $importModel = $this->getImportModel();
+ $defaultLanguage = $this->getOscDefaultLanguage();
+ $defaultLanguageId = $defaultLanguage['id'];
+ $select = "SELECT `c`.`categories_id` as `id`, `c`.`parent_id`, `cd`.`categories_name` `name` FROM `{$this->getOscTable('categories')}` c ";// WHERE `c`.`parent_id`={$parentId}";
+ $select .= " INNER JOIN `{$this->getOscTable('categories_description')}` cd on `cd`.`categories_id`=`c`.`categories_id`";
+ $select .= " AND `cd`.`language_id`={$defaultLanguageId} ";
+ if ($limit && isset($limit['from']) && isset($limit['max'])) {
+ $select .= " LIMIT {$limit['from']}, {$limit['max']} ";
+ }
+ if (!$results = $this->_getForeignAdapter()->fetchAll($select)) {
+ $results = array();
+ } else {
+ $stores = $this->getLanguagesToStores();
+ foreach($results as $index => $result) {
+ if ($categoriesToStores = $this->getCategoriesToStores($result['id'])) {
+ foreach($categoriesToStores as $store => $categoriesName) {
+ $results[$index]['stores'][$stores[$store]] = array(
+ 'name'=>html_entity_decode($this->convert($categoriesName), ENT_QUOTES, self::DEFAULT_MAGENTO_CHARSET)
+ );
+ }
+ }
+ }
+ }
+ return $results;
+ }
+
+ /**
+ * Getting language to Magento store data
+ *
+ * @return array
+ */
+ public function getLanguagesToStores()
+ {
+ $importModel = $this->getImportModel();
+ $typeId = $this->getImportTypeIdByCode('store');
+ $importId = $importModel->getId();
+ if (!$this->_languagesToStores) {
+ //$this->_languagesToStores[1] = 1;
+ $select = $this->_getReadAdapter()->select();
+ $select->from(array('ref'=>$this->getTable('oscommerce_ref')), array('value'=>'value', 'ref_id'=>'ref_id'));
+ $select->where("`ref`.`import_id`='{$importId}' AND `ref`.`type_id`='{$typeId}'");
+ $this->_languagesToStores = $this->_getReadAdapter()->fetchPairs($select);
+ }
+ return $this->_languagesToStores;
+ }
+
+ /**
+ * Getting categry description for different languages
+ *
+ * @param integer $categoryId
+ * @return mix array/boolean
+ */
+ public function getCategoriesToStores($categoryId)
+ {
+ $select = "SELECT `language_id`, `categories_name` FROM `{$this->getOscTable('categories_description')}`";
+ $select .= "WHERE `categories_id`='{$categoryId}'";
+ if ($categoryId && $result = $this->_getForeignAdapter()->fetchPairs($select)) {
+ return $result;
+ }
+ return false;
+ }
+
+ /**
+ * Getting store data of osCommerce
+ *
+ * @return array
+ */
+ public function getOscStores()
+ {
+ if (!$this->_oscStores) {
+ $select = "SELECT `languages_id` `id`, `name`, `code` `scode`, ";
+ $select .= " `directory` `code`, 1 `is_active` FROM `{$this->getOscTable('languages')}`";
+ $this->_oscStores = $this->_getForeignAdapter()->fetchAll($select);
+ }
+ return $this->_oscStores;
+ }
+
+
+ public function getOscDefaultLanguage()
+ {
+ if (!$this->_oscDefaultLanguage) {
+ $oscStoreInfo = $this->getOscStoreInformation();
+ $languageCode = $oscStoreInfo['DEFAULT_LANGUAGE'];
+ if ($stores = $this->getOscStores()) foreach($stores as $store) {
+ if ($store['scode'] == $languageCode) {
+ $this->_oscDefaultLanguage = $store;
+ }
+ }
+ }
+ return $this->_oscDefaultLanguage;
+ }
+
+ /**
+ * Getting customers from osCommerce
+ *
+ * @return array
+ */
+ public function getCustomers($limit = array())
+ {
+ $select = "SELECT `c`.`customers_id` `id`, `c`.`customers_firstname` `firstname` ";
+ $select .= " ,`c`.`customers_lastname` `lastname`, `c`.`customers_email_address` `email` ";
+ $select .= " ,`c`.`customers_telephone` `telephone`, `c`.`customers_fax` `fax` ";
+ $select .= " ,`c`.`customers_password` `password_hash`, `c`.`customers_newsletter` `is_subscribed` ";
+ $select .= " ,`ci`.`customers_info_date_account_created` `created_at` ";
+ $select .= " ,`c`.`customers_default_address_id` `default_billing` FROM `{$this->getOscTable('customers')}` c";
+ $select .= " LEFT JOIN `customers_info` ci ON `ci`.`customers_info_id`=`c`.`customers_id` ";
+ if ($limit && isset($limit['from']) && isset($limit['max'])) {
+ $select .= " LIMIT {$limit['from']}, {$limit['max']}";
+ }
+
+ if (!($result = $this->_getForeignAdapter()->fetchAll($select))) {
+ $result = array();
+ }
+
+ return $result;
+ }
+
+ public function getTotalCustomers() {
+ return $this->_getForeignAdapter()->fetchOne("SELECT count(*) FROM `{$this->getOscTable('customers')}`");
+ }
+
+ public function getCustomerName($name)
+ {
+ if (isset($name)) {
+ $n = explode(" ", $name);
+ if (sizeof($n) > 1) {
+ $newName['lastname'] = $n[(sizeof($n) - 1)];
+ $newName['fistname'] = Mage::helper('core/string')->substr($name, 0,
+ Mage::helper('core/string')->strlen($name) - (Mage::helper('core/string')->strlen($newName['lastname'] + 1))
+ );
+ return $newName;
+ } else {
+ return array('firstname' => $n);
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Getting customer address by CustomerId from osCommerce
+ *
+ * @param integer $customerId
+ * @return array
+ */
+ public function getAddresses($customerId)
+ {
+
+ $select = "SELECT `address_book_id` `id`, `customers_id`, `entry_firstname` `firstname`";
+ $select .= ", `entry_lastname` `lastname`, `entry_street_address` `street1`";
+ $select .= ", `entry_company` `company` ";
+ $select .= ", `entry_postcode` `postcode`, `entry_city` `city`";
+ $select .= ", `entry_state` `region`, `entry_country_id` `country_id`";
+ $select .= ", `entry_zone_id` `region_id` FROM `{$this->getOscTable('address_book')}` WHERE customers_id={$customerId}";
+ if (!isset($customerId) || !($result = $this->_getForeignAdapter()->fetchAll($select))) {
+ $result = array();
+ }
+ return $result;
+ }
+
+ /**
+ * Get address from address book
+ *
+ * @param integer $address_id
+ * @return array
+ */
+ public function getAddressById($addressId)
+ {
+
+ $select = "SELECT `address_book_id` `id`, `customers_id`, `entry_firstname` `firstname`";
+ $select .= ", `entry_lastname` `lastname`, `entry_street_address` `street1`";
+ $select .= ", `entry_postcode` `postcode`, `entry_city` `city`";
+ $select .= ", `entry_state` `region`, `entry_country_id` `country_id`";
+ $select .= ", `entry_zone_id` `region_id` FROM `{$this->getOscTable('address_book')}` WHERE address_book_id={$addressId}";
+ if (!isset($addressId) || !($result = $this->_getForeignAdapter()->fetchRow($select))) {
+ $result = array();
+ }
+ return $result;
+ }
+
+ /**
+ * Getting importing types for loging into oscommerce_ref
+ *
+ * @return array
+ */
+ public function getImportTypes()
+ {
+ if (! $this->_importType) {
+ $connection = $this->_getReadAdapter();
+ $select = $connection->select();
+ $select->from($this->getTable('oscommerce_type'), array('*'));
+ $this->_importType = $connection->fetchAll($select);
+ }
+ return $this->_importType;
+ }
+
+ /**
+ * Getting import_type_id by code
+ *
+ * @param integer $code
+ * @return string/boolean
+ */
+ public function getImportTypeIdByCode($code = '') {
+ $types = $this->getImportTypes();
+ if (isset($code) && $types) {
+ foreach ($types as $type) {
+ if ($type['type_code'] == $code) {
+ return $type['type_id'];
+ }
+ }
+ }
+ return false;
+ }
+
+ public function getCountryCodeData()
+ {
+ $select = "SELECT * FROM `{$this->getOscTable('countries')}`";
+ $countries = $this->_getForeignAdapter()->fetchAll($select);
+ if ($countries) foreach($countries as $country) {
+ $this->_countryIdToCode[$country['countries_id']] = $country['countries_iso_code_2'];
+ $this->_countryNameToCode[$country['countries_name']] = $country['countries_iso_code_2'];
+ }
+ }
+
+ /**
+ * Getting country code by country id
+ *
+ * @param integer $id
+ * @return string/boolean
+ */
+ public function getCountryCodeById($id)
+ {
+ if (!$this->_countryIdToCode) {
+ $this->getCountryCodeData();
+ }
+ $countries = $this->_countryIdToCode;
+ if (isset($id) && isset($countries[$id])) {
+ return $countries[$id];
+ }
+ return false;
+ }
+
+ public function getCountryCodeByName($name)
+ {
+ if (!$this->_countryNameToCode) {
+ $this->getCountryCodeData();
+ }
+ $countries = $this->_countryNameToCode;
+ if (isset($id) && isset($countries[$name])) {
+ return $countries[$name];
+ }
+ return false;
+ }
+
+ public function getCountryIdByCode($countryCode)
+ {
+ if (!$this->_countryIdToCode) {
+ $this->getCountryCodeData();
+ }
+ if (isset($code)) {
+ foreach($this->_countryToCode as $id => $code) {
+ if ($code == $countryCode) {
+ return $id;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Getting regions from osCommerce
+ *
+ * @return array
+ */
+ public function getRegions()
+ {
+ if (!$this->_regionCode) {
+ $select = "SELECT `zone_id`, `zone_name` FROM `{$this->getOscTable('zones')}`";
+ $this->_regionCode = $this->_getForeignAdapter()->fetchPairs($select);
+ }
+ return $this->_regionCode;
+ }
+
+ /**
+ * Getting region name by id
+ *
+ * @param integer $id
+ * @return string/boolean
+ */
+ public function getRegionCode($id)
+ {
+ $regions = $this->getRegions();
+ if (isset($id) && isset($regions[$id])) {
+ return $regions[$id];
+ }
+ return false;
+ }
+
+ public function setStoreLocales($locale)
+ {
+ if (isset($locale) && is_array($locale))
+ $this->_storeLocales = $locale;
+ }
+
+ public function getStoreLocales()
+ {
+ if ($this->_storeLocales) {
+ return $this->_storeLocales;
+ } else {
+ return array('default' => self::DEFAULT_LOCALE );
+ }
+ }
+
+ public function setRootCategory(Mage_Catalog_Model_Category $category) {
+ $this->_rootCategory = $category;
+ }
+
+ public function getRootCategory()
+ {
+ if (!$this->_rootCategory) {
+ $this->_rootCategory = $this->getCategoryModel()->load($this->getCurrentWebsite()->getDefaultStoreGroup()->getRootCategoryId());
+ }
+ return $this->_rootCategory;
+ }
+
+ public function setWebsiteId($id)
+ {
+ $this->_websiteId = (int) ($id ? $id : 0);
+ }
+
+ public function importTaxClasses()
+ {
+ $taxModel = Mage::getModel('tax/class');
+ $storeInfo = $this->getOscStoreInformation();
+ $storeName = $storeInfo['STORE_NAME'];
+ $taxPairs = array();
+ if ($classes = $this->getTaxClasses()) {
+ $existedClasses = $taxCollections = Mage::getResourceModel('tax/class_collection')
+ ->addFieldToFilter('class_type', 'PRODUCT')
+ ->load()
+ ->toOptionHash();
+
+ foreach ($classes as $id => $name) {
+ $taxModel->unsData();
+ $className = $name . '_' . $storeName;
+ if (in_array($className, $existedClasses)) {
+ $taxId = array_search($className, $existedClasses);
+ } else {
+ $taxModel->setId(null);
+ $taxModel->setClassType('PRODUCT');
+ $taxModel->setClassName($name . '_' . $storeName);
+ $taxModel->save();
+ $taxId = $taxModel->getId();
+ }
+ $taxPairs[$id] = $taxId;
+ }
+ }
+
+ if (sizeof($taxPairs) > 0) {
+ $this->saveLogs($taxPairs, 'taxclass');
+ }
+ }
+
+ protected function _getTaxCollections()
+ {
+ $taxPairs = $this->getLogPairsByTypeCode('taxclass');
+ $flipTaxPairs = array_flip($taxPairs);
+ $newTaxPairs = array();
+ $taxCollections = Mage::getResourceModel('tax/class_collection')
+ ->addFieldToFilter('class_type', 'PRODUCT')
+ ->load()
+ ->toOptionArray();
+ if ($taxCollections) {
+ foreach ($taxCollections as $tax) {
+ if (isset($flipTaxPairs[$tax['value']])) {
+ $newTaxPairs[$flipTaxPairs[$tax['value']]] = $tax['label'];
+ }
+ }
+ }
+ return $newTaxPairs;
+ }
+
+ public function saveLogs($data, $type = null)
+ {
+ $importId = $this->getImportModel()->getId();
+ $typeId = $this->getImportTypeIdByCode($type);
+ $userId = $this->_getCurrentUserId();
+ $createdAt = $this->formatDate(time());
+ if (is_array($data) && $typeId > 0) {
+ foreach($data as $value => $refId) {
+ $log = array(
+ 'value' => $value,
+ 'ref_id' => $refId,
+ 'import_id' => $importId,
+ 'type_id' => $typeId,
+ 'user_id' => $userId,
+ 'created_at'=> $createdAt
+ );
+ $this->_getWriteAdapter()->insert($this->getTable('oscommerce_ref'), $log);
+ }
+ }
+ }
+
+ public function getLogPairsByTypeCode($code)
+ {
+ $typeId = $this->getImportTypeIdByCode($code);
+ $importId = $this->getImportModel()->getId();
+ $result = array();
+ if (!is_null($typeId)) {
+ $select = $this->_getReadAdapter()->select();
+ $select->from($this->getTable('oscommerce_ref'), array('value','ref_id'))
+ ->where("import_id={$importId}")
+ ->where("type_id={$typeId}");
+ $result = $this->_getReadAdapter()->fetchPairs($select);
+ }
+ return $result;
+ }
+
+ public function getTaxClasses()
+ {
+ $select = "SELECT `tax_class_id` `id`, `tax_class_title` `title` FROM `{$this->getOscTable('tax_class')}`";
+ if (!($results = $this->_getForeignAdapter()->fetchPairs($select))) {
+ $results = array();
+ }
+ return $results;
+ }
+
+ private function _format($str)
+ {
+ $str = preg_replace('#[^0-9a-z\/\.]+#i', '', $str);
+ $str = strtolower(str_replace('\\s','',$str));
+ return $str;
+ }
+
+ public function setPrefixPath($prefix) {
+ if ($prefix) {
+ $this->_prefixPath = $prefix;
+ }
+ }
+
+ /**
+ * Load osCommerce orders
+ *
+ * @param integer $customerId
+ * @param integer $websiteId
+ * @return array
+ */
+ public function loadOrders($customerId, $websiteId = '')
+ {
+ if (!isset($websiteId)) {
+ $webisteId = $this->_currentWebsiteId;
+ }
+ $result = array();
+ if (!empty($customerId)) {
+ $select = $this->_getReadAdapter()->select()
+ ->from(array('order'=>$this->getTable('oscommerce_order')))
+ ->join(
+ array('order_total'=>$this->getTable('oscommerce_order_total')),
+ "order_total.osc_magento_id=order.osc_magento_id AND order_total.class='ot_total'",
+ array('value'))
+ ->where("order.magento_customers_id={$customerId}")
+ ->where("order.website_id={$websiteId}");
+ $result = $this->_getReadAdapter()->fetchAll($select);
+ }
+ return $result;
+ }
+
+ /**
+ * Load osCommerce order
+ *
+ * @param integer $id
+ * @return array
+ */
+ public function loadOrderById($id)
+ {
+ $result = array();
+ if (!empty($id)) {
+ $select = "SELECT * FROM {$this->getTable('oscommerce_order')} WHERE osc_magento_id={$id}";
+ $order = $this->_getReadAdapter()->fetchRow($select);
+ if ($order) {
+ $result['order'] = $order;
+ foreach (array('products','total','history') as $table) {
+ $select = "SELECT * FROM {$this->getTable('oscommerce_order_'.$table)} WHERE osc_magento_id={$id}";
+ $result[$table] = $this->_getReadAdapter()->fetchAll($select);
+
+ }
+ }
+
+ }
+ return $result;
+ }
+
+ // Fix for previous version
+ protected function checkOrderField()
+ {
+ $columnName = 'currency_symbol';
+ try {
+ if (!($result = $this->_getReadAdapter()->fetchRow("SHOW `columns` FROM `{$this->getTable('oscommerce_order')}` WHERE field='{$columnName}'"))) {
+ $this->_setupConnection()->query("ALTER TABLE `{$this->getTable('oscommerce_order')}` ADD {$columnName} char(3) DEFAULT NULL");
+ $this->_setupConnection()->commit();
+ }
+ } catch (Exception $e) {
+
+ }
+ }
+
+ public function setMaxRows($rows)
+ {
+ if (is_integer($rows)) {
+ $this->_maxRows = $rows;
+ }
+ }
+
+ public function getMaxRows()
+ {
+ if ($this->_maxRows <= 0) {
+ $this->_maxRows = Mage::getStoreConfig('oscommerce/import/max_rows');
+ }
+ return $this->_maxRows;
+ }
+
+ /**
+ * Retrieve website model cache
+ *
+ * @return Mage_Core_Model_Web
+ */
+ public function getWebsiteModel()
+ {
+ if (is_null($this->_websiteModel)) {
+ $object = Mage::getModel('core/website');
+ $this->_websiteModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_websiteModel);
+ }
+
+ /**
+ * Retrieve store model cache
+ *
+ * @return Mage_Core_Model_Store
+ */
+ public function getStoreModel()
+ {
+ if (is_null($this->_storeModel)) {
+ $object = Mage::getModel('core/store');
+ $this->_storeModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_storeModel);
+ }
+
+ /**
+ * Retrieve customer model cache
+ *
+ * @return Mage_Customer_Model_Customer
+ */
+ public function getCustomerModel()
+ {
+ if (is_null($this->_customerModel)) {
+ $object = Mage::getModel('customer/customer');
+ $this->_customerModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_customerModel);
+ }
+
+ /**
+ * Retrieve customer model cache
+ *
+ * @return Mage_Customer_Model_Customer
+ */
+ public function getCustomerGroupModel()
+ {
+ if (is_null($this->_customerGroupModel)) {
+ $object = Mage::getModel('customer/group');
+ $this->_customerGroupModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_customerGroupModel);
+ }
+
+ /**
+ * Retrieve address model cache
+ *
+ * @return Mage_Customer_Model_Address
+ */
+ public function getAddressModel()
+ {
+ if (is_null($this->_addressModel)) {
+ $object = Mage::getModel('customer/address');
+ $this->_addressModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_addressModel);
+ }
+
+
+ /**
+ * Retrieve category model cache
+ *
+ * @return Mage_Catalog_Model_Category
+ */
+ public function getCategoryModel()
+ {
+ if (is_null($this->_categoryModel)) {
+ $object = Mage::getModel('catalog/category');
+ $this->_categoryModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_categoryModel);
+ }
+
+ /**
+ * Retrieve category model cache
+ *
+ * @return Mage_Catalog_Model_Category
+ */
+ public function getProductModel()
+ {
+ if (is_null($this->_productModel)) {
+ $object = Mage::getModel('catalog/product');
+ $this->_productModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_productModel);
+ }
+
+ public function getProductAdapterModel()
+ {
+ if (is_null($this->_productAdapterModel)) {
+ $object = Mage::getModel('catalog/convert_adapter_product');
+ $this->_productAdapterModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_productAdapterModel);
+ }
+ /**
+ * Retrieve store group model cache
+ *
+ * @return Mage_Core_Model_Store_Group
+ */
+ public function getStoreGroupModel()
+ {
+ if (is_null($this->_storeGroupModel)) {
+ $object = Mage::getModel('core/store_group');
+ $this->_storeGroupModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_storeGroupModel);
+ }
+
+ public function getConfigModel()
+ {
+ if (is_null($this->_configModel)) {
+ $object = Mage::getModel('core/config_data');
+ $this->_configModel = Varien_Object_Cache::singleton()->save($object);
+ }
+ return Varien_Object_Cache::singleton()->load($this->_configModel);
+
+ }
+
+ public function importCollection($importId = null) {
+ $importTypes = array('website', 'root_category', 'group');
+ $result = array();
+ if (!is_null($importId)) {
+ $select = $this->_getReadAdapter()->select()
+ ->from(array('ref'=>$this->getTable('oscommerce_ref')))
+ ->join(
+ array('type'=>$this->getTable('oscommerce_type')),
+ "type.type_id=ref.type_id AND type.type_code in ('".join("','",$importTypes)."')",
+ array('type.type_code'))
+ ->where("ref.import_id={$importId}");
+ if ($results = $this->_getReadAdapter()->fetchAll($select)) {
+ foreach ($results as $result) {
+ $this->_importCollection[$result['type_code']] = $result['ref_id'];
+ }
+ }
+
+ }
+ return $this->_importCollection;
+ }
+
+ public function setImportModel(Mage_Oscommerce_Model_Oscommerce $model)
+ {
+ $this->_importModel = $model;
+ }
+
+ public function getImportModel()
+ {
+ if ($this->_importModel) {
+ return $this->_importModel;
+ }
+ }
+
+ public function getCollections($code)
+ {
+ if ($this->_importCollection) {
+ return $this->_importCollection;
+ }
+ return;
+ }
+
+ /**
+ * Deleting oscommerce reference records
+ *
+ * @param integer $id
+ */
+ public function deleteRecords($id = null)
+ {
+ if (!is_null($id) && $id > 0) {
+ if ($result = $this->_getReadAdapter()
+ ->fetchRow('SELECT * FROM '.$this->getTable('oscommerce_ref').' WHERE import_id='.$id)) {
+ $this->_getWriteAdapter()->raw_query('DELETE FROM '.$this->getTable('oscommerce_ref').' WHERE import_id='.$id);
+ }
+ }
+ }
+
+ /**
+ * Formatting string
+ *
+ * @param string $input
+ * @param integer $number
+ * @return string
+ */
+ protected function _formatStringTruncate($data, $number)
+ {
+ if (str_word_count($data, 0)>$number) {
+ $wordKey = str_word_count($data, 1);
+ $posKey = str_word_count($data, 2);
+ reset($posKey);
+ foreach ($wordKey as $key => &$value) {
+ $value=key($posKey);
+ next($posKey);
+ }
+ return substr($data, 0, $wordKey[$number]);
+ } else {
+ return $data;
+ }
+ }
+
+ /**
+ * Getting current user ID
+ *
+ * @return string
+ */
+ protected function _getCurrentUserId()
+ {
+ if (!$this->_currentUserId) {
+ $this->_currentUserId = Mage::getSingleton('admin/session')->getUser()->getId();
+ $this->_logData['user_id'] = $this->_currentUserId;
+ }
+ return $this->_currentUserId;
+ }
+
+ /**
+ * Getting oscommerce table with prefix
+ *
+ * @param string $table
+ * @return string
+ */
+ function getOscTable($table)
+ {
+ return $this->_prefix.$table;
+ }
+
+ /**
+ * Setting connection charset
+ *
+ * @param string $charset
+ */
+ public function setConnectionCharset($charset)
+ {
+ $this->_connectionCharset = $charset;
+ }
+
+ /**
+ * Getting connection charset, set deafult as utf8
+ * if there is no predefine charset
+ *
+ * @return string
+ */
+ public function getConnectionCharset()
+ {
+ if (!$this->_connectionCharset) {
+ $this->_connectionCharset = self::DEFAULT_FIELD_CHARSET;
+ }
+ return $this->_connectionCharset;
+ }
+
+ public function resetConnectionCharset()
+ {
+ $charset = $this->getConnectionCharset();
+ $this->_getForeignAdapter()->query("SET NAMES '{$charset}'");
+ }
+
+
+ /**
+ * Setting dataCharset by user defined encoding charset
+ *
+ * @param string $charset
+ */
+ public function setDataCharset($charset)
+ {
+ if (!is_null($charset)) {
+ $this->_dataCharset = $charset;
+ }
+ }
+
+ /**
+ * Getting dataCharset
+ *
+ * @return string
+ */
+ public function getDataCharset()
+ {
+ return $this->_dataCharset;
+ }
+
+ /**
+ * Converting encoded charsets
+ *
+ * @param mixed $data
+ * @param array $notIncludedFields
+ * @return mixed
+ */
+ public function convert($data, array $notIncludedFields = array())
+ {
+ $charset = $this->getDataCharset();
+ if (!is_null($charset) || $charset != self::DEFAULT_FIELD_CHARSET) {
+ if (is_array($data)) {
+ foreach($data as $field => $value) {
+ if (!in_array($field, $notIncludedFields)) {
+ $newValue = @iconv($charset, self::DEFAULT_FIELD_CHARSET, $value);
+ if (strlen($newValue)) {
+ $data[$field] = $newValue;
+ }
+ }
+ }
+ } else {
+ $newValue = @iconv($charset, self::DEFAULT_MAGENTO_CHARSET, $data);
+ if (strlen($newValue)) {
+ $data = $newValue;
+ }
+ }
+ }
+ return $data;
+ }
+
+ /**
+ * Getting saveRows
+ *
+ * @return integer
+ */
+ public function getSaveRows()
+ {
+ return $this->_saveRows;
+ }
+
+ /**
+ * Resetting saveRows as zero
+ *
+ */
+ protected function _resetSaveRows()
+ {
+ $this->_saveRows = 0;
+ }
+
+ /**
+ * Adding error messages
+ *
+ * @param string $error
+ */
+ protected function _addErrors($error)
+ {
+ if (isset($error)) $this->_errors[] = $error;
+ }
+
+ /**
+ * Getting all errors
+ *
+ * @return array
+ */
+ public function getErrors()
+ {
+ if (sizeof($this->_errors) > 0) {
+ return $this->_errors;
+ }
+ }
+
+ /**
+ * Resetting error as empty array
+ *
+ */
+ protected function _resetErrors()
+ {
+ $this->_errors = array();
+ }
+}
diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Collection.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Collection.php
new file mode 100755
index 0000000000..6843da807c
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Collection.php
@@ -0,0 +1,38 @@
+
+ */
+class Mage_Oscommerce_Model_Mysql4_Oscommerce_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('oscommerce/oscommerce');
+ }
+}
diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order.php
new file mode 100644
index 0000000000..637fb098c5
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order.php
@@ -0,0 +1,81 @@
+
+ */
+class Mage_Oscommerce_Model_Mysql4_Oscommerce_Order extends Mage_Core_Model_Mysql4_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('oscommerce/oscommerce_order', 'osc_magento_id');
+ }
+
+ public function getProducts()
+ {
+ $order = Mage::registry('current_oscommerce_order');
+ $result = array();
+ if ($order && $order->getData() && $id = $order->getId())
+ {
+ $select = $this->_getReadAdapter()->select();
+ $select->from($this->getTable('oscommerce_order_products'))
+ ->where("osc_magento_id={$id}");
+ $result = $this->_getReadAdapter()->fetchAll($select);
+ }
+ return $result;
+ }
+
+ public function getTotal()
+ {
+ $order = Mage::registry('current_oscommerce_order');
+ $result = array();
+ if ($order && $order->getData() && $id = $order->getId())
+ {
+ $select = $this->_getReadAdapter()->select();
+ $select->from($this->getTable('oscommerce_order_total'))
+ ->where("osc_magento_id={$id}")->order('sort_order');
+ $result = $this->_getReadAdapter()->fetchAll($select);
+ }
+ return $result;
+ }
+
+ public function getComments()
+ {
+ $order = Mage::registry('current_oscommerce_order');
+ $result = array();
+ if ($order && $order->getData() && $id = $order->getId())
+ {
+ $select = $this->_getReadAdapter()->select();
+ $select->from($this->getTable('oscommerce_order_history'))
+ ->where("osc_magento_id={$id}");
+ $result = $this->_getReadAdapter()->fetchAll($select);
+ }
+ return $result;
+ }
+}
+
diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order/Collection.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order/Collection.php
new file mode 100644
index 0000000000..4673bc541a
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce/Order/Collection.php
@@ -0,0 +1,55 @@
+
+ */
+class Mage_Oscommerce_Model_Mysql4_Oscommerce_Order_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('oscommerce/oscommerce_order');
+ }
+
+ public function addOrderTotalField()
+ {
+ $this->_select
+ ->from(null, array('orders_total'=>new Zend_Db_Expr('FORMAT(main_table.orders_total,2)')));
+ return $this;
+ }
+
+ public function load($printQuery=false, $logQuery=false)
+ {
+ if ($this->isLoaded()) {
+ return $this;
+ }
+ $this->addOrderTotalField();
+ parent::load($printQuery, $logQuery);
+ return $this;
+ }
+}
diff --git a/app/code/core/Mage/Oscommerce/Model/Oscommerce.php b/app/code/core/Mage/Oscommerce/Model/Oscommerce.php
new file mode 100755
index 0000000000..3181e86713
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Model/Oscommerce.php
@@ -0,0 +1,87 @@
+
+ */
+class Mage_Oscommerce_Model_Oscommerce extends Mage_Core_Model_Abstract
+{
+ const DEFAULT_PORT = 3360;
+ const CONNECTION_TYPE = 'pdo_mysql';
+ const CONNECTION_NAME = 'oscommerce_db';
+
+ protected function _construct()
+ {
+ $this->_init('oscommerce/oscommerce');
+ }
+
+ protected function _afterLoad()
+ {
+ parent::_afterLoad();
+ Mage::getSingleton('oscommerce/config')->initForeignConnection($this->getData());
+
+// if (Mage::app()->getRequest()->getActionName() == 'run') {
+// $this->importStores();
+// }
+
+ }
+ /**
+ * Get paypal session namespace
+ *
+ * @return Mage_Paypal_Model_Session
+ */
+ public function getSession()
+ {
+ return Mage::getSingleton('oscommerce/session');
+ }
+
+ public function importStores() {
+ $this->getResource()->importStores($this);
+ }
+
+ public function getImportTypeIdByCode($code = '') {
+ return $this->getResource()->getImportTypeIdByCode($code);
+ }
+
+ public function loadOrders($customerId, $websiteId)
+ {
+ return $this->getResource()->loadOrders($customerId, $websiteId);
+ }
+
+ public function loadOrderById($id)
+ {
+ return $this->getResource()->loadOrderById($id);
+ }
+
+ public function deleteImportedRecords($id)
+ {
+ if (isset($id) && $id == $this->getId()) {
+ $this->getResource()->deleteRecords($id);
+ }
+ }
+}
diff --git a/app/code/core/Mage/Oscommerce/Model/Oscommerce/Order.php b/app/code/core/Mage/Oscommerce/Model/Oscommerce/Order.php
new file mode 100644
index 0000000000..6a0bc6cd49
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Model/Oscommerce/Order.php
@@ -0,0 +1,55 @@
+
+ */
+class Mage_Oscommerce_Model_Oscommerce_Order extends Mage_Core_Model_Abstract
+{
+
+ protected function _construct()
+ {
+ $this->_init('oscommerce/oscommerce_order');
+ }
+
+ public function getProducts()
+ {
+ return $this->getResource()->getProducts();
+ }
+
+ public function getTotal()
+ {
+ return $this->getResource()->getTotal();
+ }
+
+ public function getComments()
+ {
+ return $this->getResource()->getComments();
+ }
+
+}
diff --git a/app/code/core/Mage/Oscommerce/Model/Session.php b/app/code/core/Mage/Oscommerce/Model/Session.php
new file mode 100644
index 0000000000..c660040a79
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/Model/Session.php
@@ -0,0 +1,39 @@
+
+ */
+class Mage_Oscommerce_Model_Session extends Mage_Core_Model_Session_Abstract
+{
+ public function __construct()
+ {
+ $this->init('oscommerce');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/controllers/Adminhtml/ImportController.php b/app/code/core/Mage/Oscommerce/controllers/Adminhtml/ImportController.php
new file mode 100644
index 0000000000..35d2b9de59
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/controllers/Adminhtml/ImportController.php
@@ -0,0 +1,422 @@
+
+ */
+class Mage_Oscommerce_Adminhtml_ImportController extends Mage_Adminhtml_Controller_Action
+{
+ /**
+ * Initailization action of importController
+ */
+ protected function _initAction()
+ {
+ $this->loadLayout();
+ $this->_setActiveMenu('oscommerce/adminhtml_import');
+ return $this;
+ }
+
+ /**
+ * Initialization of importController
+ *
+ * @param idFieldnName string
+ * @return Mage_Oscommerce_Adminhtml_ImportController
+ */
+ protected function _initImport($idFieldName = 'id')
+ {
+ $id = (int) $this->getRequest()->getParam($idFieldName);
+ $model = Mage::getModel('oscommerce/oscommerce');
+ if ($id) {
+ $model->load($id);
+ }
+
+ Mage::register('oscommerce_adminhtml_import', $model);
+ return $this;
+ }
+
+ /**
+ * Index action of importController
+ */
+ public function indexAction()
+ {
+ $this->_initAction();
+ $this->_addContent(
+ $this->getLayout()->createBlock('oscommerce/adminhtml_import')
+ );
+ $this->renderLayout();
+ }
+
+ /**
+ * Edit action of importController
+ */
+ public function editAction()
+ {
+ $this->_initImport();
+ $this->loadLayout();
+
+ $model = Mage::registry('oscommerce_adminhtml_import');
+ $data = Mage::getSingleton('adminhtml/session')->getSystemConvertOscData(true);
+
+ if (!empty($data)) {
+ $model->addData($data);
+ }
+
+ $this->_initAction();
+ $this->_addBreadcrumb
+ (Mage::helper('oscommerce')->__('Edit osCommerce Profile'),
+ Mage::helper('oscommerce')->__('Edit osCommerce Profile'));
+ /**
+ * Append edit tabs to left block
+ */
+ $this->_addLeft($this->getLayout()->createBlock('oscommerce/adminhtml_import_edit_tabs'));
+
+ $this->_addContent($this->getLayout()->createBlock('oscommerce/adminhtml_import_edit'));
+
+ $this->renderLayout();
+ }
+
+ /**
+ * Create new action of importController
+ */
+ public function newAction()
+ {
+ $this->_forward('edit');
+ }
+
+ /**
+ * Save action of
+ */
+ public function saveAction()
+ {
+ if ($data = $this->getRequest()->getPost()) {
+ if (isset($data['send_subscription'])) {
+ $data['send_subscription'] = 1;
+ } else {
+ $data['send_subscription'] = 0;
+ }
+
+ $this->_initImport('import_id');
+ $model = Mage::registry('oscommerce_adminhtml_import');
+
+ // Prepare saving data
+ if (isset($data)) {
+ $model->addData($data);
+ }
+
+// if (empty($data['port']))
+// $data['port'] = Mage_Oscommerce_Model_Oscommerce::DEFAULT_PORT;
+
+ try {
+ $model->save();
+
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('oscommerce')->__('osCommerce Profile was successfully saved'));
+ }
+ catch (Exception $e){
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
+ Mage::getSingleton('adminhtml/session')->setSystemConvertOscData($data);
+ $this->getResponse()->setRedirect($this->getUrl('*/*/edit', array('id'=>$model->getId())));
+ return;
+ }
+ }
+ if ($this->getRequest()->getParam('continue')) {
+ $this->_redirect('*/*/edit', array('id'=>$model->getId()));
+ } else {
+ $this->_redirect('*/*');
+ }
+ }
+
+ public function batchRunAction()
+ {
+ @set_time_limit(0);
+ $this->_initImport('import_id');
+ $importModel = Mage::registry('oscommerce_adminhtml_import');
+
+ if ($tablePrefix = $importModel->getTablePrefix()) {
+ $importModel->getResource()->setTablePrefix($tablePrefix);
+ }
+
+ // Start setting data from sessions
+ if ($connCharset = $importModel->getSession()->getConnectionCharset()) {
+ $importModel->getResource()->setConnectionCharset($connCharset);
+ }
+ if ($dataCharset = $importModel->getSession()->getDataCharset()) {
+ $importModel->getResource()->setDataCharset($dataCharset);
+ }
+ if ($timezone = $importModel->getSession()->getTimezone()) {
+ $importModel->setTimezone($timezone);
+ }
+ if ($storeLocales = $importModel->getSession()->getStoreLocales()) {
+ $importModel->getResource()->setStoreLocales($storeLocales);
+ }
+ if ($isPoductWithCategories = $importModel->getSession()->getIsProductWithCategories()) {
+ $importModel->getResource()->setIsProductWithCategories($isPoductWithCategories);
+ }
+ // End setting data from sessions
+
+ // Resetting connection charset
+ $importModel->getResource()->resetConnectionCharset();
+
+ $importModel->getResource()->setImportModel($importModel);
+ if ($collections = $importModel->getResource()->importCollection($importModel->getId())) {
+ if (isset($collections['website'])) {
+ $importModel->getResource()->getWebsiteModel()->load($collections['website']);
+ }
+ if (isset($collections['root_category'])) {
+ $importModel->getResource()->setRootCategory(clone $importModel->getResource()->getCategoryModel()->load($collections['root_category']));
+ }
+ if (isset($collections['group'])) {
+ $importModel->getResource()->getStoreGroupModel()->load($collections['group']);
+
+ }
+ }
+
+ //$isUnderDefaultWebsite = $this->getRequest()->getParam('under_default_website') ? true: false;
+ $importType = $this->getRequest()->getParam('import_type');
+ $importFrom = $this->getRequest()->getParam('from');
+ $isImportDone = $this->getRequest()->getParam('is_done');
+ switch($importType) {
+ case 'products':
+ $importModel->getResource()->importProducts($importFrom, true);
+ break;
+ case 'categories':
+ $importModel->getResource()->importCategories($importFrom, true);
+ if ($isImportDone == 'true') {
+ $importModel->getResource()->buildCategoryPath();
+ }
+ break;
+ case 'customers':
+ $importModel->getResource()->importCustomers($importFrom, true, $importModel->getData('send_subscription'));
+ break;
+ case 'orders':
+ $importModel->getResource()->importOrders($importFrom, true);
+ break;
+ }
+
+ $errors = $importModel->getResource()->getErrors();
+ $result = array(
+ 'savedRows' => $importModel->getResource()->getSaveRows(),
+ 'errors' => ( $errors ? $errors: array())
+ );
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
+ }
+
+ public function runAction()
+ {
+ @set_time_limit(0);
+ Mage::app()->cleanCache(); // Clean all cach
+ $this->_initImport();
+ $importModel = Mage::registry('oscommerce_adminhtml_import');
+ /** @var $importModel Mage_Oscommerce_Model_Oscommerce */
+ $totalRecords = array();
+
+ // Start handling charsets
+ $connCharset = $this->getRequest()->getParam('connection_charset');
+ if ($connCharset) {
+ $importModel->getSession()->setConnectionCharset($connCharset);
+ $importModel->getResource()->setConnectionCharset($connCharset);
+ }
+ $dataCharset = $this->getRequest()->getParam('data_charset');
+ if ($dataCharset) {
+ $importModel->getSession()->setDataCharset($dataCharset);
+ $importModel->getResource()->setDataCharset($dataCharset);
+ } // End hanlding charsets
+
+ $timezone = $this->getRequest()->getParam('timezone');
+ $importModel->getSession()->setTimezone($timezone);
+ $importModel->getResource()->resetConnectionCharset();
+
+ if ($tablPrefix = $importModel->getTablePrefix()) {
+ $importModel->getResource()->setTablePrefix($tablPrefix);
+ }
+
+ $importModel->getResource()->setImportModel($importModel);
+ $importModel->getResource()->importCollection($importModel->getId());
+
+ // Setting Locale for stores
+ $locales = explode("|",$this->getRequest()->getParam('store_locale'));
+ $storeLocales = array();
+ if ($locales) foreach($locales as $locale) {
+ $localeCode = explode(':', $locale);
+ $storeLocales[$localeCode[0]] = $localeCode[1];
+ }
+
+ $importModel->getSession()->setStoreLocales($storeLocales);
+ $importModel->getResource()->setStoreLocales($storeLocales);
+ // End setting Locale for stores
+
+ $websiteId = $this->getRequest()->getParam('website_id');
+ $websiteCode = $this->getRequest()->getParam('website_code');
+ $options = $this->getRequest()->getParam('import');
+
+ // Checking Website, StoreGroup and RootCategory
+ if (!$websiteId) {
+ $importModel->getResource()->setWebsiteCode($websiteCode);
+ $importModel->getResource()->createWebsite();
+ } else {
+ $importModel->getResource()->createWebsite($websiteId);
+ }
+ // End checking Website, StoreGroup and RootCategory
+
+ $importModel->getResource()->importStores();
+ $importModel->getResource()->importTaxClasses();
+ $importModel->getResource()->createOrderTables();
+
+ if (isset($options['categories'])) {
+ $importModel->getSession()->setIsProductWithCategories(true);
+ $totalRecords['categories'] = $importModel->getResource()->getCategoriesCount();
+ }
+ if (isset($options['products'])) {
+ $totalRecords['products'] = $importModel->getResource()->getProductsCount();
+ }
+ if (isset($options['customers'])) {
+ $totalRecords['customers'] = $importModel->getResource()->getCustomersCount();
+ }
+ if (isset($options['customers']) && isset($options['orders'])) {
+ $totalRecords['orders'] = $importModel->getResource()->getOrdersCount();
+ }
+ if ($totalRecords) {
+ $importModel->setTotalRecords($totalRecords);
+ Mage::unRegister('oscommerce_adminhtml_import');
+ Mage::register('oscommerce_adminhtml_import', $importModel);
+ }
+ $this->getResponse()->setBody($this->getLayout()->createBlock('oscommerce/adminhtml_import_run')->toHtml());
+ $this->getResponse()->sendResponse();
+ }
+
+ public function batchFinishAction()
+ {
+ if ($importId = $this->getRequest()->getParam('id')) {
+ $importModel = Mage::getModel('oscommerce/oscommerce')->load($importId);
+ /* @var $batchModel Mage_Dataflow_Model_Batch */
+
+ if ($importId = $importModel->getId()) {
+ $importModel->deleteImportedRecords($importId);
+// $importModel->getSession()->unsStoreLocales();
+// $importModel->getSession()->unsIsProductWithCategories();
+// if ($importModel->getSession()->getTablePrefix()) {
+// $importModel->getSession()->unsTablePrefix();
+// }
+ $importModel->getSession()->clear();
+ }
+ }
+ }
+
+ /**
+ * Delete osc action
+ */
+ public function deleteAction()
+ {
+ $this->_initImport();
+ $model = Mage::registry('oscommerce_adminhtml_import');
+ if ($model->getId()) {
+ try {
+ $model->delete();
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('oscommerce')->__('osCommerce profile was deleted'));
+ }
+ catch (Exception $e){
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
+ }
+ }
+ $this->_redirect('*/*/');
+ }
+
+ /**
+ * Ajax checking store
+ *
+ */
+ public function checkStoreAction()
+ {
+ $this->_initImport();
+ $importModel = Mage::registry('oscommerce_adminhtml_import');
+ $error = false;
+ if ($importModel->getId()) {
+ try {
+ $charset = $importModel->getResource()->getConnectionCharset();
+ $defaultOscCharset = Mage_Oscommerce_Model_Mysql4_Oscommerce::DEFAULT_OSC_CHARSET;
+ $defaultMageCharset = Mage_Oscommerce_Model_Mysql4_Oscommerce::DEFAULT_MAGENTO_CHARSET;
+
+ $stores = $importModel->getResource()->getOscStores();
+
+ $locales = Mage::app()->getLocale()->getOptionLocales();
+ $options = '';
+ foreach ($locales as $locale) {
+ $options .= "{$locale['label']} ";
+ }
+ $html = '';
+ if ($stores) {
+ $html .= "\n";
+ foreach ($stores as $store) {
+ $html .= "" . $importModel->getResource()->convert($store['name']) . " Store ";
+ $html .= "getMessage())? Mage::helper('oscommerce')->__('languages table error '):'') . $e->getMessage();
+ }
+
+ if ($error) {
+ $result = array(
+ 'error' => true,
+ 'messages' => $html
+ );
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
+ } else {
+ $this->getResponse()->setBody($html);
+ }
+ }
+ }
+
+ public function checkWebsiteCodeAction()
+ {
+
+ $this->_initImport();
+ $model = Mage::registry('oscommerce_adminhtml_import');
+ if ($model->getId()) {
+ $website = Mage::getModel('core/website');
+ $collections = $website->getCollection();
+ $result = 'false';
+ $websiteCode = $this->getRequest()->getParam('website_code');
+ if ($collections) foreach ($collections as $collection) {
+ if ($collection->getCode() == $websiteCode) {
+ $result = 'true';
+ }
+ }
+ $this->getResponse()->setBody($result);
+ }
+ }
+
+ protected function _isAllowed()
+ {
+ return Mage::getSingleton('admin/session')->isAllowed('system/convert/oscimport');
+ }
+}
diff --git a/app/code/core/Mage/Oscommerce/controllers/Adminhtml/OrderController.php b/app/code/core/Mage/Oscommerce/controllers/Adminhtml/OrderController.php
new file mode 100644
index 0000000000..0579779f8d
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/controllers/Adminhtml/OrderController.php
@@ -0,0 +1,101 @@
+
+ */
+
+class Mage_Oscommerce_Adminhtml_OrderController extends Mage_Adminhtml_Controller_Action
+{
+
+ /**
+ * Initailization of action
+ */
+ protected function _initAction()
+ {
+ $this->loadLayout()
+ ->_setActiveMenu('sales/oscorder')
+ ->_addBreadcrumb(Mage::helper('oscommerce')->__('Sales'), Mage::helper('checkout')->__('Sales'))
+ ->_addBreadcrumb(Mage::helper('oscommerce')->__('osCommerce Orders'), Mage::helper('checkout')->__('osCommerce Orders'))
+ ;
+ return $this;
+ }
+
+
+ /**
+ * Initialization of order
+ *
+ * @param idFieldnName string
+ * @return Mage_Adminhtml_System_Convert_OscController
+ */
+ protected function _initOrder()
+ {
+ $id = $this->getRequest()->getParam('order_id');
+ $order = Mage::getModel('oscommerce/oscommerce_order')->load($id);
+
+ if (!$order->getId()) {
+ $this->_getSession()->addError($this->__('This order no longer exists.'));
+ $this->_redirect('*/*/');
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
+ return false;
+ }
+
+ Mage::register('current_oscommerce_order', $order);
+ return $order;
+ }
+
+ /**
+ * Index osc action
+ */
+ public function indexAction()
+ {
+ $this->_initAction();
+ $this->_addContent(
+ $this->getLayout()->createBlock('oscommerce/adminhtml_order')
+ );
+ $this->renderLayout();
+ }
+
+ /**
+ * osCommerce Order view page
+ */
+ public function viewAction()
+ {
+ if ($order = $this->_initOrder()) {
+ $this->_initAction()
+ ->_addBreadcrumb($this->__('View Order'), $this->__('View Order'))
+ ->_addContent($this->getLayout()->createBlock('oscommerce/adminhtml_order_view'))
+ ->renderLayout();
+ }
+ }
+
+ protected function _isAllowed()
+ {
+ return Mage::getSingleton('admin/session')->isAllowed('sales/oscorder');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/controllers/OrderController.php b/app/code/core/Mage/Oscommerce/controllers/OrderController.php
new file mode 100644
index 0000000000..d7ff1ab5fb
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/controllers/OrderController.php
@@ -0,0 +1,100 @@
+
+ */
+
+class Mage_Oscommerce_OrderController extends Mage_Core_Controller_Front_Action
+{
+
+ /**
+ * Action predispatch
+ *
+ * Check customer authentication for some actions
+ */
+ public function preDispatch()
+ {
+ parent::preDispatch();
+ $action = $this->getRequest()->getActionName();
+ $loginUrl = Mage::helper('customer')->getLoginUrl();
+ if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
+ }
+ }
+
+
+ /**
+ * Check osCommerce order view availability
+ *
+ * @param array $order
+ * @return bool
+ */
+ protected function _canViewOrder($order)
+ {
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
+ if (isset($order['osc_magento_id']) && isset($order['magento_customers_id']) && $order['magento_customers_id'] == $customerId) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ *
+ */
+ public function indexAction()
+ {
+ $this->_redirect('sales/order/history');
+ }
+
+ /**
+ * osCommerce Order view page
+ */
+ public function viewAction()
+ {
+ $orderId = (int) $this->getRequest()->getParam('order_id');
+ if (!$orderId) {
+ $this->_redirect('sales/order/history');
+ return;
+ }
+
+ $order = Mage::getModel('oscommerce/oscommerce')->loadOrderById($orderId);
+ if ($order && $this->_canViewOrder($order['order'])) {
+ Mage::register('current_oscommerce_order', $order);
+ $this->loadLayout();
+ if ($navigationBlock = $this->getLayout()->getBlock('customer_account_navigation')) {
+ $navigationBlock->setActive('oscommerce/order/view');
+ }
+
+ $this->renderLayout();
+ }
+ else {
+ $this->_redirect('sales/order/history');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/etc/charsets.xml b/app/code/core/Mage/Oscommerce/etc/charsets.xml
new file mode 100644
index 0000000000..ae72daa8ca
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/etc/charsets.xml
@@ -0,0 +1,595 @@
+
+
+
+
+
+ Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+
+This file lists all of the available character sets.
+To make maintaining easier please:
+ - keep records sorted by collation number.
+ - change charsets.max-id when adding a new collation.
+
+
+
+ Traditional Chinese
+ Big5 Traditional Chinese
+ big-5
+ bigfive
+ big-five
+ cn-big5
+ csbig5
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Central European
+ ISO 8859-2 Central European
+ csisolatin2
+ iso-8859-2
+ iso-ir-101
+ iso_8859-2
+ iso_8859-2:1987
+ l2
+
+
+ Hungarian
+ Polish
+ Romanian
+ Croatian
+ Slovak
+ Slovenian
+ Sorbian
+
+
+
+
+
+
+
+ Western
+ DEC West European
+
+
+ Dutch
+ English
+ French
+ German Duden
+ Italian
+ Latin
+ Portuguese
+ Spanish
+
+
+
+
+ Western
+ DOS West European
+ 850
+ cspc850multilingual
+ ibm850
+
+ Dutch
+ English
+ French
+ German Duden
+ Italian
+ Latin
+ Portuguese
+ Spanish
+
+
+
+
+
+ Western
+ cp1252 West European
+ csisolatin1
+ iso-8859-1
+ iso-ir-100
+ iso_8859-1
+ iso_8859-1:1987
+ l1
+ latin1
+
+
+ primary
+ compiled
+
+
+
+
+
+ binary
+ compiled
+
+
+ Dutch
+ English
+ French
+ German Duden
+ Italian
+ Latin
+ Portuguese
+ Spanish
+
+
+ Dutch
+ English
+ French
+ German Duden
+ Italian
+ Latin
+ Portuguese
+ Spanish
+
+
+
+
+ Western
+ HP West European
+ hproman8
+
+
+ Dutch
+ English
+ French
+ German Duden
+ Italian
+ Latin
+ Portuguese
+ Spanish
+
+
+
+
+ Cyrillic
+ KOI8-R Relcom Russian
+ koi8-r
+ cskoi8r
+
+
+
+
+
+ Western
+ 7bit Swedish
+ iso-646-se
+
+
+
+
+
+ Western
+ US ASCII
+ us
+ us-ascii
+ csascii
+ iso-ir-6
+ iso646-us
+
+
+
+
+
+ Japanese
+ EUC-JP Japanese
+ euc-jp
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Japanese
+ Shift-JIS Japanese
+ s-jis
+ shift-jis
+ x-sjis
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Cyrillic
+ Windows Cyrillic
+ windows-1251
+ ms-cyr
+ ms-cyrillic
+
+ Belarusian
+ Bulgarian
+ Macedonian
+ Russian
+ Serbian
+ Mongolian
+ Ukrainian
+
+
+
+
+ Belarusian
+ Bulgarian
+ Macedonian
+ Russian
+ Serbian
+ Mongolian
+ Ukrainian
+
+
+ Belarusian
+ Bulgarian
+ Macedonian
+ Russian
+ Serbian
+ Mongolian
+ Ukrainian
+
+
+
+
+ Hebrew
+ ISO 8859-8 Hebrew
+ csisolatinhebrew
+ iso-8859-8
+ iso-ir-138
+
+
+
+
+
+ Thai
+ TIS620 Thai
+ tis-620
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Korean
+ EUC-KR Korean
+ euc_kr
+ euc-kr
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Baltic
+ ISO 8859-13 Baltic
+ BalticRim
+ iso-8859-13
+ l7
+
+ Estonian
+
+
+ Latvian
+ Lithuanian
+ primary
+
+
+ Latvian
+ Lithuanian
+
+
+
+
+
+ Cyrillic
+ KOI8-U Ukrainian
+ koi8-u
+
+
+
+
+
+ Simplified Chinese
+ GB2312 Simplified Chinese
+ chinese
+ iso-ir-58
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Greek
+ ISO 8859-7 Greek
+ csisolatingreek
+ ecma-118
+ greek8
+ iso-8859-7
+ iso-ir-126
+
+
+
+
+
+ Central European
+ Windows Central European
+ ms-ce
+ windows-1250
+
+ Hungarian
+ Polish
+ Romanian
+ Croatian
+ Slovak
+ Slovenian
+ Sorbian
+
+
+ Croatian
+
+
+ compiled
+
+
+
+
+
+ East Asian
+ GBK Simplified Chinese
+ cp936
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Baltic
+ Windows Baltic
+ WinBaltRim
+ windows-1257
+
+
+
+ Latvian
+ Lithuanian
+
+
+
+
+
+
+ South Asian
+ ISO 8859-9 Turkish
+ csisolatin5
+ iso-8859-9
+ iso-ir-148
+ l5
+ latin5
+ turkish
+
+
+
+
+
+ South Asian
+ ARMSCII-8 Armenian
+ armscii-8
+
+
+
+
+
+ Unicode
+ UTF-8 Unicode
+ utf-8
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Unicode
+ UCS-2 Unicode
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Cyrillic
+ DOS Russian
+ 866
+ csibm866
+ ibm866
+ DOSCyrillicRussian
+
+
+
+
+
+ Central European
+ DOS Kamenicky Czech-Slovak
+
+
+
+
+
+ Central European
+ Mac Central European
+ MacCentralEurope
+
+ Hungarian
+ Polish
+ Romanian
+ Croatian
+ Slovak
+ Slovenian
+ Sorbian
+
+
+
+
+
+ Western
+ Mac West European
+ Mac
+ Macintosh
+ csmacintosh
+
+ Dutch
+ English
+ French
+ German Duden
+ Italian
+ Latin
+ Portuguese
+ Spanish
+
+
+
+
+
+
+
+
+ Central European
+ DOS Central European
+ 852
+ cp852
+ ibm852
+
+ Hungarian
+ Polish
+ Romanian
+ Croatian
+ Slovak
+ Slovenian
+ Sorbian
+
+
+
+
+
+ Arabic
+ Windows Arabic
+ ms-arab
+ windows-1256
+
+
+ Arabic
+ Persian
+ Pakistani
+ Urdu
+
+
+
+
+ South Asian
+ GEOSTD8 Georgian
+
+
+
+
+
+ Binary pseudo charset
+
+ primary
+ compiled
+
+
+
+
+ Japanese
+ SJIS for Windows Japanese
+ ms_cp932
+ sjis_cp932
+ sjis_ms
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+ Japanese
+ UJIS for Windows Japanese
+ eucjpms
+ eucJP_ms
+ ujis_ms
+ ujis_cp932
+
+ primary
+ compiled
+
+
+ binary
+ compiled
+
+
+
+
+
diff --git a/app/code/core/Mage/Oscommerce/etc/config.xml b/app/code/core/Mage/Oscommerce/etc/config.xml
new file mode 100755
index 0000000000..f4bd9f73e9
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/etc/config.xml
@@ -0,0 +1,224 @@
+
+
+
+
+
+ 0.8.10
+
+
+
+
+
+ Mage_Oscommerce_Model
+ oscommerce_mysql4
+
+
+ Mage_Oscommerce_Model_Mysql4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ oscommerce_orders_products
+
+
+
+
+
+ oscommerce_orders_status_history
+
+
+
+
+
+
+ Mage_Oscommerce_Block
+
+
+
+
+
+ Mage_Oscommerce
+
+
+ core_setup
+
+
+
+
+ core_write
+
+
+
+
+ core_read
+
+
+
+
+ pdo_mysql
+ mysql4
+ 1
+
+
+
+
+
+
+
+ admin
+
+ Mage_Oscommerce
+ oscommerce
+
+
+
+
+
+
+
+
+
+
+
+ osCommerce
+ oscommerce/adminhtml_import
+
+
+
+
+
+
+
+
+ osCommerce Orders
+ oscommerce/adminhtml_order
+ 100
+
+
+
+
+
+
+
+
+
+
+
+ osCommerce Orders
+ 100
+
+
+
+
+
+
+
+
+ osCommerce
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+ singleton
+ admin/observer
+ actionPreDispatchAdmin
+
+
+
+
+
+
+
+
+
+ standard
+
+ Mage_Oscommerce
+ oscommerce
+
+
+
+
+
+
+ oscommerce.xml
+
+
+
+
+
+
+
+
+ 10
+
+
+
+
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-install-0.8.0.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-install-0.8.0.php
new file mode 100755
index 0000000000..360f23ffed
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-install-0.8.0.php
@@ -0,0 +1,72 @@
+startSetup();
+
+$installer->run("
+
+-- DROP TABLE IF EXISTS `{$this->getTable('oscommerce_import')}`;
+
+CREATE TABLE `{$this->getTable('oscommerce_import')}` (
+ `import_id` int(10) unsigned NOT NULL auto_increment,
+ `name` varchar(255) default NULL,
+ `created_at` datetime default NULL,
+ `updated_at` datetime default NULL,
+ `host` varchar(255) NOT NULL,
+ `port` int(5) NOT NULL,
+ `db_name` varchar(255) default NULL,
+ `db_user` varchar(255) default NULL,
+ `db_password` varchar(255) default NULL,
+ `db_type` varchar(32) default NULL,
+ PRIMARY KEY (`import_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `{$this->getTable('oscommerce_import_type')}` (
+ `type_id` int(2) unsigned NOT NULL auto_increment,
+ `type_code` varchar(32) NOT NULL,
+ `type_name` varchar(255) NOT NULL,
+ PRIMARY KEY (`type_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
+
+insert into `{$this->getTable('oscommerce_import_type')}`(`type_id`,`type_code`,`type_name`) values (1,'store','Store'),(2,'category','Category'),(3,'product','Product'), (4,'customer','Customer'),(5,'order','Order');
+
+CREATE TABLE `{$this->getTable('oscommerce_ref')}` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `import_id` int(10) NOT NULL,
+ `type_id` int(10) NOT NULL,
+ `value` int(10) NOT NULL,
+ `ref_id` int(10) NOT NULL,
+ `created_at` datetime default NULL,
+ `user_id` int(10) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.0-0.8.1.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.0-0.8.1.php
new file mode 100755
index 0000000000..24d8dc8e04
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.0-0.8.1.php
@@ -0,0 +1,47 @@
+startSetup();
+
+$installer->run("
+
+DROP TABLE IF EXISTS `{$this->getTable('oscommerce_import_type')}`;
+
+CREATE TABLE `{$this->getTable('oscommerce_import_type')}` (
+ `type_id` int(2) unsigned NOT NULL auto_increment,
+ `type_code` varchar(32) NOT NULL,
+ `type_name` varchar(255) NOT NULL,
+ PRIMARY KEY (`type_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+insert into `{$this->getTable('oscommerce_import_type')}`(`type_code`,`type_name`) values ('website', 'Website'),('store','Store'),('category','Category'),('product','Product'), ('customer','Customer'),('order','Order');
+
+");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.1-0.8.2.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.1-0.8.2.php
new file mode 100644
index 0000000000..a8fa808971
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.1-0.8.2.php
@@ -0,0 +1,41 @@
+startSetup();
+
+$installer->run("
+
+truncate `{$this->getTable('oscommerce_import_type')}`;
+insert into `{$this->getTable('oscommerce_import_type')}`(`type_code`,`type_name`) values ('website', 'Website'),('store','Store'),('category','Category'),('product','Product'), ('customer','Customer'),('order','Order'),('group','Store Group'), ('taxclass', 'Product Tax Class');
+
+ALTER TABLE `{$this->getTable('oscommerce_import')}` ADD table_prefix VARCHAR(32) DEFAULT NULL;
+
+");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.2-0.8.3.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.2-0.8.3.php
new file mode 100644
index 0000000000..b07a605a4c
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.2-0.8.3.php
@@ -0,0 +1,125 @@
+startSetup();
+
+$installer->run("
+CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_orders')}` (
+ `osc_magento_id` int(11) NOT NULL auto_increment,
+ `orders_id` int(11) NOT NULL,
+ `customers_id` int(11) NOT NULL default '0',
+ `magento_customers_id` int(11) NOT NULL default '0',
+ `import_id` int(11) NOT NULL default '0',
+ `website_id` int(11) NOT NULL default '0',
+ `customers_name` varchar(64) NOT NULL default '',
+ `customers_company` varchar(32) default NULL,
+ `customers_street_address` varchar(64) NOT NULL default '',
+ `customers_suburb` varchar(32) default NULL,
+ `customers_city` varchar(32) NOT NULL default '',
+ `customers_postcode` varchar(10) NOT NULL default '',
+ `customers_state` varchar(32) default NULL,
+ `customers_country` varchar(32) NOT NULL default '',
+ `customers_telephone` varchar(32) NOT NULL default '',
+ `customers_email_address` varchar(96) NOT NULL default '',
+ `customers_address_format_id` int(5) NOT NULL default '0',
+ `delivery_name` varchar(64) NOT NULL default '',
+ `delivery_company` varchar(32) default NULL,
+ `delivery_street_address` varchar(64) NOT NULL default '',
+ `delivery_suburb` varchar(32) default NULL,
+ `delivery_city` varchar(32) NOT NULL default '',
+ `delivery_postcode` varchar(10) NOT NULL default '',
+ `delivery_state` varchar(32) default NULL,
+ `delivery_country` varchar(32) NOT NULL default '',
+ `delivery_address_format_id` int(5) NOT NULL default '0',
+ `billing_name` varchar(64) NOT NULL default '',
+ `billing_company` varchar(32) default NULL,
+ `billing_street_address` varchar(64) NOT NULL default '',
+ `billing_suburb` varchar(32) default NULL,
+ `billing_city` varchar(32) NOT NULL default '',
+ `billing_postcode` varchar(10) NOT NULL default '',
+ `billing_state` varchar(32) default NULL,
+ `billing_country` varchar(32) NOT NULL default '',
+ `billing_address_format_id` int(5) NOT NULL default '0',
+ `payment_method` varchar(255) NOT NULL default '',
+ `cc_type` varchar(20) default NULL,
+ `cc_owner` varchar(64) default NULL,
+ `cc_number` varchar(32) default NULL,
+ `cc_expires` varchar(4) default NULL,
+ `last_modified` datetime default NULL,
+ `date_purchased` datetime default NULL,
+ `orders_status` int(5) NOT NULL default '0',
+ `orders_date_finished` datetime default NULL,
+ `currency` char(3) default NULL,
+ `currency_value` decimal(14,6) default NULL,
+ `currency_symbol` char(3) default NULL,
+ PRIMARY KEY (`osc_magento_id`),
+ KEY `idx_orders_customers_id` (`customers_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_orders_products')}` (
+ `orders_products_id` int(11) NOT NULL auto_increment,
+ `osc_magento_id` int(11) NOT NULL default '0',
+ `products_id` int(11) NOT NULL default '0',
+ `products_model` varchar(12) default NULL,
+ `products_name` varchar(64) NOT NULL default '',
+ `products_price` decimal(15,4) NOT NULL default '0.0000',
+ `final_price` decimal(15,4) NOT NULL default '0.0000',
+ `products_tax` decimal(7,4) NOT NULL default '0.0000',
+ `products_quantity` int(2) NOT NULL default '0',
+ PRIMARY KEY (`orders_products_id`),
+ KEY `idx_orders_products_osc_magento_id` (`osc_magento_id`),
+ KEY `idx_orders_products_products_id` (`products_id`)
+) ENGINE=MyISAM CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_orders_total')}` (
+ `orders_total_id` int(10) unsigned NOT NULL auto_increment,
+ `osc_magento_id` int(11) NOT NULL default '0',
+ `title` varchar(255) NOT NULL default '',
+ `text` varchar(255) NOT NULL default '',
+ `value` decimal(15,4) NOT NULL default '0.0000',
+ `class` varchar(32) NOT NULL default '',
+ `sort_order` int(11) NOT NULL default '0',
+ PRIMARY KEY (`orders_total_id`),
+ KEY `idx_orders_total_osc_magento_id` (`osc_magento_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `{$this->getTable('oscommerce_orders_status_history')}`(
+ `orders_status_history_id` int(11) NOT NULL auto_increment,
+ `osc_magento_id` int(11) NOT NULL default '0',
+ `orders_status_id` int(5) NOT NULL default '0',
+ `date_added` datetime NOT NULL default '0000-00-00 00:00:00',
+ `customer_notified` int(1) default '0',
+ `comments` text,
+ PRIMARY KEY (`orders_status_history_id`),
+ KEY `idx_orders_status_history_osc_magento_id` (`osc_magento_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+");
+
+$installer->endSetup();
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.3-0.8.4.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.3-0.8.4.php
new file mode 100644
index 0000000000..c2c9902924
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.3-0.8.4.php
@@ -0,0 +1,36 @@
+startSetup();
+
+$installer->run("
+ ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD orders_total decimal(14,6) default NULL;
+");
+
+$installer->endSetup();
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.4-0.8.5.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.4-0.8.5.php
new file mode 100644
index 0000000000..a6f951002c
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.4-0.8.5.php
@@ -0,0 +1,37 @@
+startSetup();
+
+$installer->run("
+ ALTER TABLE `{$this->getTable('oscommerce_orders')}` MODIFY orders_status varchar(32) default NULL;
+ ALTER TABLE `{$this->getTable('oscommerce_orders_status_history')}` ADD orders_status varchar(32) default NULL;
+");
+
+$installer->endSetup();
\ No newline at end of file
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.5-0.8.6.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.5-0.8.6.php
new file mode 100644
index 0000000000..857fda4840
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.5-0.8.6.php
@@ -0,0 +1,37 @@
+startSetup();
+
+$installer->run("
+
+insert into `{$this->getTable('oscommerce_import_type')}`(`type_code`,`type_name`) values ('root_category', 'Root Category');
+");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.6-0.8.7.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.6-0.8.7.php
new file mode 100644
index 0000000000..191fd2f3d5
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.6-0.8.7.php
@@ -0,0 +1,39 @@
+startSetup();
+
+$installer->run("
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE `{$this->getTable('oscommerce_orders_products')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE `{$this->getTable('oscommerce_orders_status_history')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+ALTER TABLE `{$this->getTable('oscommerce_orders_total')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
+");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.7-0.8.8.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.7-0.8.8.php
new file mode 100644
index 0000000000..220f46444b
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.7-0.8.8.php
@@ -0,0 +1,41 @@
+startSetup();
+
+$installer->run("
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD purchased_year INT(4) DEFAULT NULL;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD purchased_month INT(2) DEFAULT NULL;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD purchased_day INT(2) DEFAULT NULL;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD modified_year INT(4) DEFAULT NULL;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD modified_month INT(2) DEFAULT NULL;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` ADD modified_day INT(2) DEFAULT NULL;
+");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.8-0.8.9.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.8-0.8.9.php
new file mode 100644
index 0000000000..3bedb45beb
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.8-0.8.9.php
@@ -0,0 +1,41 @@
+startSetup();
+
+$installer->run("
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN purchased_year;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN purchased_month;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN purchased_day;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN modified_year;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN modified_month;
+ALTER TABLE `{$this->getTable('oscommerce_orders')}` DROP COLUMN modified_day;
+");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.9-0.8.10.php b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.9-0.8.10.php
new file mode 100644
index 0000000000..92981409a2
--- /dev/null
+++ b/app/code/core/Mage/Oscommerce/sql/oscommerce_setup/mysql4-upgrade-0.8.9-0.8.10.php
@@ -0,0 +1,38 @@
+startSetup();
+
+$installer->run("
+
+ALTER TABLE `{$this->getTable('oscommerce_import')}` ADD send_subscription BOOL NOT NULL DEFAULT '0';
+
+");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type.php b/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type.php
new file mode 100644
index 0000000000..224ba5dc5b
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type.php
@@ -0,0 +1,46 @@
+
+ */
+class Mage_Paybox_Block_Adminhtml_Cart_Type extends Mage_Adminhtml_Block_System_Config_Form_Field
+{
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
+ {
+ $additional = Mage::getSingleton('core/layout')->createBlock('paybox/adminhtml_cart_type_select')
+ ->setTemplate('paybox/adminhtml/cart/type/select.phtml')
+ ->setDependHtmlId($element->getHtmlId())
+ ->toHtml();
+
+ return parent::_getElementHtml($element).$additional;
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type/Select.php b/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type/Select.php
new file mode 100644
index 0000000000..7c26150f40
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Block/Adminhtml/Cart/Type/Select.php
@@ -0,0 +1,56 @@
+
+ */
+class Mage_Paybox_Block_Adminhtml_Cart_Type_Select extends Mage_Adminhtml_Block_Template
+{
+ /**
+ * Enter description here...
+ *
+ * @return Mage_Paybox_Model_System
+ */
+ public function getModel()
+ {
+ return Mage::getModel('paybox/system');
+ }
+
+ public function getParentHtmlId()
+ {
+ return substr($this->getDependHtmlId(), 0, strrpos($this->getDependHtmlId(), 'typecarte')) . 'typepaiement';
+ }
+
+ public function getJsonCartTypes()
+ {
+ return $this->getModel()->getJsonCartTypes();
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Block/Direct/Form.php b/app/code/core/Mage/Paybox/Block/Direct/Form.php
new file mode 100644
index 0000000000..b024b9881a
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Block/Direct/Form.php
@@ -0,0 +1,42 @@
+
+ */
+class Mage_Paybox_Block_Direct_Form extends Mage_Payment_Block_Form_Cc
+{
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setTemplate('paybox/direct/form.phtml');
+ }
+
+}
diff --git a/app/code/core/Mage/Paybox/Block/Direct/Info.php b/app/code/core/Mage/Paybox/Block/Direct/Info.php
new file mode 100644
index 0000000000..13ecdc8a90
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Block/Direct/Info.php
@@ -0,0 +1,48 @@
+
+ */
+class Mage_Paybox_Block_Direct_Info extends Mage_Payment_Block_Info_Cc
+{
+ protected function _construct()
+ {
+ parent::_construct();
+ $this->setTemplate('paybox/direct/info.phtml');
+ }
+
+ public function toPdf()
+ {
+ $this->setTemplate('paybox/direct/pdf/info.phtml');
+ return $this->toHtml();
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Block/System/Error.php b/app/code/core/Mage/Paybox/Block/System/Error.php
new file mode 100644
index 0000000000..c33836758b
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Block/System/Error.php
@@ -0,0 +1,93 @@
+
+ */
+class Mage_Paybox_Block_System_Error extends Mage_Core_Block_Template
+{
+
+ /**
+ * Error messages desciptions
+ *
+ * @var array
+ */
+ protected $_pbxErrorsDesc;
+
+ /**
+ * Enter description here...
+ *
+ * @return Mage_Checkout_Model_Session
+ */
+ public function getCheckout()
+ {
+ return Mage::getSingleton('checkout/session');
+ }
+
+ public function getErrorMessage()
+ {
+ if (empty($this->_pbxErrorsDesc)) {
+ $this->_pbxErrorsDesc = array(
+ '-1' => 'Error in reading the parameters via stdin (POST method) (error in http reception)',
+ '-2' => 'Error in memory allocation. Not enough memory available on the trader\'s server',
+ '-3' => 'Error in reading the parameters QUERY_STRING or CONTENT_LENGTH. (http error)',
+ '-4' => 'PBX_RETOUR, PBX_ANNULE, PBX_REFUSE or PBX_EFFECTUE are too long (<150 characters)',
+ '-5' => 'Error in opening the file (if PBX_MODE contains 3) : local file non-existent, not found or access error',
+ '-6' => 'Error in file format (if PBX_MODE contains 3) : local file badly formed, empty or lines are badly formatted',
+ '-7' => 'A compulsory variable is missing (PBX_SITE, PBX_RANG, PBX_IDENTIFIANT, PBX_TOTAL, PBX_CMD, etc.)',
+ '-8' => 'One of the numerical variables contains a non-numerical character (site, rank, identifier, amount, currency etc.)',
+ '-9' => 'PBX_SITE contains a site number which does not consist of exactly 7 characters',
+ '-10' => 'PBX_RANG contains a rank number which does not consist of exactly 2 characters',
+ '-11' => 'PBX_TOTAL has more than 10 or fewer than 3 numerical characters',
+ '-12' => 'PBX_LANGUE or PBX_DEVISE contains a code which does not contain exactly 3 characters',
+ '-13' => 'PBX_CMD is empty or contains a reference longer than 250 characters',
+ '-14' => '',
+ '-15' => '',
+ '-16' => 'PBX_PORTEUR does not contain a valid e-mail address',
+ '-17' => 'Error of coherence (multi-baskets) : Reserved Future Usage',
+ );
+ }
+ $msg = Mage::helper('paybox')->__($this->_pbxErrorsDesc[$this->getCheckout()->getPayboxErrorNumber()]);
+ $this->getCheckout()->unsPayboxErrorNumber();
+ return $msg;
+ }
+
+ /**
+ * Get continue shopping url
+ *
+ * @return string
+ */
+ public function getContinueShoppingUrl()
+ {
+ return Mage::getUrl('checkout/cart', array('_secure' => true));
+ }
+
+}
diff --git a/app/code/core/Mage/Paybox/Block/System/Failure.php b/app/code/core/Mage/Paybox/Block/System/Failure.php
new file mode 100644
index 0000000000..76cff37597
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Block/System/Failure.php
@@ -0,0 +1,61 @@
+
+ */
+class Mage_Paybox_Block_System_Failure extends Mage_Core_Block_Template
+{
+ /**
+ * Enter description here...
+ *
+ * @return Mage_Checkout_Model_Session
+ */
+ public function getCheckout()
+ {
+ return Mage::getSingleton('checkout/session');
+ }
+
+ public function getErrorMessage()
+ {
+ $msg = Mage::helper('paybox')->__($this->getCheckout()->getPayboxErrorMessage());
+ $this->getCheckout()->unsPayboxErrorMessage();
+ return $msg;
+ }
+
+ /**
+ * Get continue shopping url
+ */
+ public function getContinueShoppingUrl()
+ {
+ return Mage::getUrl('checkout/cart', array('_secure' => true));
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Block/System/Form.php b/app/code/core/Mage/Paybox/Block/System/Form.php
new file mode 100644
index 0000000000..57b5b2309a
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Block/System/Form.php
@@ -0,0 +1,42 @@
+
+ */
+class Mage_Paybox_Block_System_Form extends Mage_Payment_Block_Form
+{
+ protected function _construct()
+ {
+ $this->setTemplate('paybox/system/form.phtml');
+ parent::_construct();
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Block/System/Redirect.php b/app/code/core/Mage/Paybox/Block/System/Redirect.php
new file mode 100644
index 0000000000..36bce602ce
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Block/System/Redirect.php
@@ -0,0 +1,57 @@
+
+ */
+class Mage_Paybox_Block_System_Redirect extends Mage_Core_Block_Abstract
+{
+ protected function _toHtml()
+ {
+ $system = $this->getOrder()->getPayment()->getMethodInstance();
+
+ $form = new Varien_Data_Form();
+ $form->setAction(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).$system->getPayboxFile())
+ ->setId('paybox_system_checkout')
+ ->setName('paybox_system_checkout')
+ ->setMethod('POST')
+ ->setUseContainer(true);
+ foreach ($system->getFormFields() as $field=>$value) {
+ $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
+ }
+ $html = '';
+ $html.= $this->__('You will be redirected to Paybox in a few seconds.');
+ $html.= $form->toHtml();
+ $html.= '';
+ $html.= '';
+
+ return $html;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Helper/Data.php b/app/code/core/Mage/Paybox/Helper/Data.php
new file mode 100644
index 0000000000..3cd1a7a7ba
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Helper/Data.php
@@ -0,0 +1,37 @@
+
+ */
+class Mage_Paybox_Helper_Data extends Mage_Core_Helper_Abstract
+{
+
+}
diff --git a/app/code/core/Mage/Paybox/Model/Api/Debug.php b/app/code/core/Mage/Paybox/Model/Api/Debug.php
new file mode 100644
index 0000000000..d3ba960cc4
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Api/Debug.php
@@ -0,0 +1,40 @@
+
+ */
+class Mage_Paybox_Model_Api_Debug extends Mage_Core_Model_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('paybox/api_debug');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Direct.php b/app/code/core/Mage/Paybox/Model/Direct.php
new file mode 100644
index 0000000000..844967baa6
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Direct.php
@@ -0,0 +1,506 @@
+
+ */
+class Mage_Paybox_Model_Direct extends Mage_Payment_Model_Method_Cc
+{
+ /**
+ * Paybox direct payment actions
+ */
+ const PBX_PAYMENT_ACTION_ATHORIZE = '00001';
+ const PBX_PAYMENT_ACTION_DEBIT = '00002';
+ const PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE = '00003';
+ const PBX_PAYMENT_ACTION_CANCELLATION = '00005';
+ const PBX_PAYMENT_ACTION_REFUND = '00004';
+
+ const PBX_VERSION = '00103';
+
+ /**
+ * ECL(Electronic Commerce Indicator).
+ * Type of ordering items. Need for some banks.
+ * 024 - request by internet
+ */
+ const PBX_ACTIVITE_VALUE = '024';
+
+ protected $_code = 'paybox_direct';
+
+ protected $_isGateway = true;
+ protected $_canAuthorize = true;
+ protected $_canCapture = true;
+ protected $_canCapturePartial = false;
+ protected $_canRefund = true;
+ protected $_canVoid = false;
+ protected $_canUseInternal = true;
+ protected $_canUseCheckout = true;
+ protected $_canUseForMultishipping = true;
+ protected $_canSaveCc = true;
+
+ protected $_formBlockType = 'paybox/direct_form';
+ protected $_infoBlockType = 'paybox/direct_info';
+
+ protected $_order;
+ protected $_currenciesNumbers;
+ protected $_questionNumberModel;
+
+ /**
+ * Return paybox gateway url.
+ * If $recallNumber > 0 (primary url is not available) return url of backup gateway
+ *
+ * @param integer $recallNumber
+ * @return string
+ */
+ public function getPayboxUrl($recallNumber)
+ {
+ $path = 'pbx_url';
+ if ($recallNumber) {
+ $path = 'pbx_backupurl';
+ }
+ return $this->getConfigData($path);
+ }
+
+ /**
+ * Get Payment Action of Paybox Direct,
+ * changed to Paybox specification
+ *
+ * @return string
+ */
+ public function getPaymentAction()
+ {
+ $paymentAction = $this->getConfigData('payment_action');
+ switch ($paymentAction) {
+ case self::ACTION_AUTHORIZE:
+ return self::PBX_PAYMENT_ACTION_ATHORIZE;
+ break;
+ case self::ACTION_AUTHORIZE_CAPTURE:
+ return self::PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE;
+ break;
+ default:
+ return self::PBX_PAYMENT_ACTION_ATHORIZE;
+ break;
+ }
+ }
+
+ /**
+ * Return site number of account (TPE)
+ *
+ * @return string
+ */
+ public function getSiteNumber()
+ {
+ return $this->getConfigData('pbx_site');
+ }
+
+ /**
+ * Return rang number of account
+ *
+ * @return string
+ */
+ public function getRang()
+ {
+ return $this->getConfigData('pbx_rang');
+ }
+
+ /**
+ * Return Cle number of account
+ *
+ * @return string
+ */
+ public function getCleNumber()
+ {
+ return $this->getConfigData('pbx_cle');
+ }
+
+ /**
+ * Return currency number in ISO4217 format
+ *
+ * @return string
+ */
+ public function getCurrencyNumb()
+ {
+ $currencyCode = $this->getPayment()->getOrder()->getBaseCurrencyCode();
+ if (!$this->_currenciesNumbers) {
+ $this->_currenciesNumbers = simplexml_load_file(Mage::getBaseDir().'/app/code/core/Mage/Paybox/etc/currency.xml');
+ }
+ if ($this->_currenciesNumbers->$currencyCode) {
+ return (string)$this->_currenciesNumbers->$currencyCode;
+ }
+ }
+
+ /**
+ * Return model of Question Number
+ *
+ * @return Mage_Paybox_Model_Question_Number
+ */
+ public function getQuestionNumberModel()
+ {
+ if (!$this->_questionNumberModel) {
+ $accountHash = md5($this->getSiteNumber().$this->getRang());
+ $this->_questionNumberModel = Mage::getModel('paybox/question_number')->load($accountHash, 'account_hash');
+ }
+ return $this->_questionNumberModel;
+ }
+
+ /**
+ * Return Debug Flag
+ *
+ * @return string
+ */
+ public function getDebugFlag()
+ {
+ return $this->getConfigData('debug_flag');
+ }
+
+ public function authorize(Varien_Object $payment, $amount)
+ {
+ parent::authorize($payment, $amount);
+
+ $this->setAmount($amount)
+ ->setPayment($payment);
+
+ if ($this->callDoDirectPayment()!==false) {
+ $payment->setStatus(self::STATUS_APPROVED)
+ ->setLastTransId($this->getTransactionId())
+ ->setPayboxRequestNumber($this->getRequestNumber())
+ ->setPayboxQuestionNumber($this->getQuestionNumber());
+ } else {
+ $e = $this->getError();
+ if (isset($e['message'])) {
+ $message = Mage::helper('paybox')->__('There has been an error processing your payment. ') . $e['message'];
+ } else {
+ $message = Mage::helper('paybox')->__('There has been an error processing your payment. Please try later or contact us for help.');
+ }
+ Mage::throwException($message);
+ }
+
+ return $this;
+ }
+
+ public function capture(Varien_Object $payment, $amount)
+ {
+ parent::capture($payment, $amount);
+
+ $this->setAmount($amount)
+ ->setPayment($payment);
+
+ if ($payment->getLastTransId()) {//if after authorize
+ $result = $this->callDoDebitPayment()!==false;
+ } else {//authorize+capture (debit)
+ $result = $this->callDoDirectPayment()!==false;
+ }
+
+ if ($result) {
+ $payment->setStatus(self::STATUS_APPROVED)
+ ->setLastTransId($this->getTransactionId())
+ ->setPayboxRequestNumber($this->getRequestNumber());
+ } else {
+ $e = $this->getError();
+ if (isset($e['message'])) {
+ $message = Mage::helper('paybox')->__('There has been an error processing your payment. ') . $e['message'];
+ } else {
+ $message = Mage::helper('paybox')->__('There has been an error processing your payment. Please try later or contact us for help.');
+ }
+ Mage::throwException($message);
+ }
+
+ return $this;
+ }
+
+ public function cancel(Varien_Object $payment)
+ {
+ $payment->setStatus(self::STATUS_DECLINED);
+ return $this;
+ }
+
+ public function refund(Varien_Object $payment, $amount)
+ {
+ parent::refund($payment, $amount);
+
+ $error = false;
+ if($payment->getRefundTransactionId() && $amount>0) {
+ $this->setTransactionId($payment->getRefundTransactionId())
+ ->setPayment($payment)
+ ->setAmount($amount);
+
+ if ($this->callDoRefund()!==false) {
+ $payment->setStatus(self::STATUS_SUCCESS)
+ ->setCcTransId($this->getTransactionId());
+ } else {
+ $payment->setStatus(self::STATUS_ERROR);
+ $e = $this->getError();
+ if (isset($e['message'])) {
+ $error = $e['message'];
+ } else {
+ $error = Mage::helper('paybox')->__('Error in refunding the payment');
+ }
+ }
+ } else {
+ $payment->setStatus(self::STATUS_ERROR);
+ $error = Mage::helper('paybox')->__('Error in refunding the payment');
+ }
+ if ($error !== false) {
+ Mage::throwException($error);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Building array of params for direct payment
+ *
+ * @return bool | array
+ */
+ public function callDoDirectPayment()
+ {
+ $payment = $this->getPayment();
+ $requestStr = '';
+
+ $tmpArr = array(
+ 'VERSION' => self::PBX_VERSION,
+ 'DATEQ' => Mage::getModel('core/date')->date('dmYHis'),
+ 'TYPE' => $this->getPaymentAction(),
+ 'NUMQUESTION' => $this->getQuestionNumberModel()->getNextQuestionNumber(),
+ 'SITE' => $this->getSiteNumber(),
+ 'RANG' => $this->getRang(),
+ 'CLE' => $this->getCleNumber(),
+ 'IDENTIFIANT' => '',
+ 'MONTANT' => ($this->getAmount()*100),
+ 'DEVISE' => $this->getCurrencyNumb(),
+ 'REFERENCE' => base64_encode($payment->getOrder()->getRealOrderId()),
+ 'PORTEUR' => $payment->getCcNumber(),
+ 'DATEVAL' => Mage::getModel('core/date')->date('my', mktime(0,0,0,$payment->getCcExpMonth(),1,$payment->getCcExpYear())),
+ 'CVV' => $payment->getCcCid(),
+ 'ACTIVITE' => self::PBX_ACTIVITE_VALUE,
+ );
+
+ foreach ($tmpArr as $param=>$value) {
+ $requestStr .= $param . '=' . $value . '&';
+ }
+ $requestStr = substr($requestStr, 0, -1);
+
+ $resultArr = $this->call($requestStr);
+
+ if ($resultArr === false) {
+ return false;
+ }
+
+ $this->getQuestionNumberModel()
+ ->increaseQuestionNumber();
+
+ $this->setTransactionId($resultArr['NUMTRANS']);
+ $this->setRequestNumber($resultArr['NUMAPPEL']);
+ $this->setQuestionNumber($resultArr['NUMQUESTION']);
+
+ return $resultArr;
+ }
+
+ /**
+ * Building array of params for debit (after authorize)
+ *
+ * @return bool | array
+ */
+ public function callDoDebitPayment()
+ {
+ $payment = $this->getPayment();
+ $requestStr = '';
+
+ $tmpArr = array(
+ 'VERSION' => self::PBX_VERSION,
+ 'DATEQ' => Mage::getModel('core/date')->date('dmYHis'),
+ 'TYPE' => self::PBX_PAYMENT_ACTION_DEBIT,
+ 'NUMQUESTION' => $payment->getPayboxQuestionNumber(),
+ 'SITE' => $this->getSiteNumber(),
+ 'RANG' => $this->getRang(),
+ 'CLE' => $this->getCleNumber(),
+ 'MONTANT' => ($this->getAmount()*100),
+ 'DEVISE' => (string)$this->getCurrencyNumb(),
+ 'REFERENCE' => base64_encode($payment->getOrder()->getRealOrderId()),
+ 'NUMAPPEL' => $payment->getPayboxRequestNumber(),
+ 'NUMTRANS' => $payment->getLastTransId(),
+ );
+
+ foreach ($tmpArr as $param=>$value) {
+ $requestStr .= $param . '=' . $value . '&';
+ }
+ $requestStr = substr($requestStr, 0, -1);
+
+ $resultArr = $this->call($requestStr);
+
+ if ($resultArr === false) {
+ return false;
+ }
+
+ $this->setTransactionId($resultArr['NUMTRANS']);
+
+ return $resultArr;
+ }
+
+ /**
+ * Building array of params for refund
+ *
+ * @return bool | array
+ */
+ public function callDoRefund()
+ {
+ $payment = $this->getPayment();
+ $requestStr = '';
+
+ $tmpArr = array(
+ 'VERSION' => self::PBX_VERSION,
+ 'DATEQ' => Mage::getModel('core/date')->date('dmYHis'),
+ 'TYPE' => self::PBX_PAYMENT_ACTION_REFUND,
+ 'NUMQUESTION' => $this->getQuestionNumberModel()->getNextQuestionNumber(),
+ 'SITE' => $this->getSiteNumber(),
+ 'RANG' => $this->getRang(),
+ 'CLE' => $this->getCleNumber(),
+ 'MONTANT' => ($this->getAmount()*100),
+ 'DEVISE' => (string)$this->getCurrencyNumb(),
+ 'REFERENCE' => base64_encode($payment->getOrder()->getRealOrderId()),
+ 'PORTEUR' => $payment->getCcNumber(),
+ 'DATEVAL' => Mage::getModel('core/date')->date('my', mktime(0,0,0,$payment->getCcExpMonth(),1,$payment->getCcExpYear())),
+ 'NUMAPPEL' => '',
+ 'NUMTRANS' => '',
+ );
+
+ foreach ($tmpArr as $param=>$value) {
+ $requestStr .= $param . '=' . $value . '&';
+ }
+ $requestStr = substr($requestStr, 0, -1);
+
+ $resultArr = $this->call($requestStr);
+
+ if ($resultArr === false) {
+ return false;
+ }
+
+ $this->getQuestionNumberModel()
+ ->increaseQuestionNumber();
+
+ $this->setTransactionId($resultArr['NUMTRANS']);
+
+ return $resultArr;
+ }
+
+ /**
+ * Making a call to gateway
+ *
+ * @param string $requestStr
+ * @return bool | array
+ */
+ public function call($requestStr)
+ {
+ if ($this->getDebugFlag()) {
+ $debug = Mage::getModel('paybox/api_debug')
+ ->setRequestBody($requestStr)
+ ->save();
+ }
+ $recall = true;
+ $recallCounter = 0;
+ while ($recall && $recallCounter < 3) {
+ $recall = false;
+ $this->unsError();
+
+ $http = new Varien_Http_Adapter_Curl();
+ $config = array('timeout' => 30);
+ $http->setConfig($config);
+ $http->write(Zend_Http_Client::POST, $this->getPayboxUrl($recallCounter), '1.1', array(), $requestStr);
+ $response = $http->read();
+
+ $response = preg_split('/^\r?$/m', $response, 2);
+ $response = trim($response[1]);
+
+ if ($http->getErrno()) {
+ $http->close();
+ if ($this->getDebugFlag()) {
+ $debug->setResponseBody($response)->save();
+ }
+ $this->setError(array(
+ 'message' => $http->getError()
+ ));
+ return false;
+ }
+ $http->close();
+
+ $parsedResArr = $this->parseResponseStr($response);
+
+ //primary gateway is down, need to recall to backup gateway
+ if ($parsedResArr['CODEREPONSE'] == '00001' ||
+ $parsedResArr['CODEREPONSE'] == '00097' ||
+ $parsedResArr['CODEREPONSE'] == '00098'
+ ) {
+ $recallCounter++;
+ $recall = true;
+ }
+ }
+
+ if ($this->getDebugFlag()) {
+ $debug->setResponseBody($response)->save();
+ }
+
+ //if backup gateway was down too
+ if ($recall) {
+ $this->setError(array(
+ 'message' => Mage::helper('paybox')->__('Paybox payment gateway is not available right now')
+ ));
+ return false;
+ }
+
+ if ($parsedResArr['CODEREPONSE'] == '00000') {
+ return $parsedResArr;
+ }
+
+ if (isset($parsedResArr['COMMENTAIRE'])) {
+ $this->setError(array(
+ 'message' => $parsedResArr['CODEREPONSE'] . ':' . $parsedResArr['COMMENTAIRE']
+ ));
+ }
+
+ return false;
+ }
+
+ /**
+ * Parsing response string
+ *
+ * @param string $str
+ * @return array
+ */
+ public function parseResponseStr($str)
+ {
+ $tmpResponseArr = explode('&', $str);
+ $responseArr = array();
+ foreach ($tmpResponseArr as $response) {
+ $paramValue = explode('=', $response);
+ $responseArr[$paramValue[0]] = $paramValue[1];
+ }
+
+ return $responseArr;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug.php
new file mode 100644
index 0000000000..c0f530df34
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug.php
@@ -0,0 +1,40 @@
+
+ */
+class Mage_Paybox_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('paybox/api_debug', 'debug_id');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug/Collection.php
new file mode 100644
index 0000000000..b59bdde53c
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Mysql4/Api/Debug/Collection.php
@@ -0,0 +1,40 @@
+
+ */
+class Mage_Paybox_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('paybox/api_debug');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Mysql4/Question/Number.php b/app/code/core/Mage/Paybox/Model/Mysql4/Question/Number.php
new file mode 100644
index 0000000000..a80a7fbf64
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Mysql4/Question/Number.php
@@ -0,0 +1,41 @@
+
+ */
+class Mage_Paybox_Model_Mysql4_Question_Number extends Mage_Core_Model_Mysql4_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('paybox/question_number', 'account_id');
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Mysql4/Setup.php b/app/code/core/Mage/Paybox/Model/Mysql4/Setup.php
new file mode 100644
index 0000000000..d1ea0e9213
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Mysql4/Setup.php
@@ -0,0 +1,37 @@
+
+ */
+class Mage_Paybox_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup
+{
+
+}
diff --git a/app/code/core/Mage/Paybox/Model/Question/Number.php b/app/code/core/Mage/Paybox/Model/Question/Number.php
new file mode 100644
index 0000000000..096420d329
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Question/Number.php
@@ -0,0 +1,95 @@
+
+ */
+class Mage_Paybox_Model_Question_Number extends Mage_Core_Model_Abstract
+{
+ /**
+ * Max value of question number
+ */
+ const MAX_QUESTION_NUMBER_VALUE = 2147483647;
+
+ protected $_accountHash;
+
+ protected function _construct()
+ {
+ $this->_init('paybox/question_number');
+ }
+
+ public function load($id, $field=null)
+ {
+ $this->_accountHash = $id;
+ return parent::load($id, $field);
+ }
+
+ protected function _afterLoad()
+ {
+ //need to create new record (with default data) if it first time using of paybox direct
+ if (!$this->getAccountHash()) {
+ $this->setAccountHash($this->_accountHash);
+ $this->setIncrementValue(1);
+ $this->save();
+ }
+ unset($this->_accountHash);
+
+ //need to set default value of question number if it reach max value
+ if ($this->getIncrementValue() >= self::MAX_QUESTION_NUMBER_VALUE) {
+ $this->setResetDate('CURRENT_TIMESTAMP')
+ ->setIncrementValue(1);
+ }
+
+ return parent::_afterLoad();
+ }
+
+ /**
+ * Return next number formated to paybox specification
+ *
+ * @return string
+ */
+ public function getNextQuestionNumber()
+ {
+ $questionNumber = $this->getIncrementValue()+1;
+ return sprintf('%010d', $questionNumber);
+ }
+
+ /**
+ * Increase question number and save it after successful transaction
+ *
+ * @return Mage_Paybox_Model_Question_Number
+ */
+ public function increaseQuestionNumber()
+ {
+ $this->setIncrementValue($this->getIncrementValue()+1)
+ ->save();
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Source/CartType.php b/app/code/core/Mage/Paybox/Model/Source/CartType.php
new file mode 100644
index 0000000000..0f4566f69d
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Source/CartType.php
@@ -0,0 +1,61 @@
+
+ */
+class Mage_Paybox_Model_Source_CartType
+{
+ /**
+ * Enter description here...
+ *
+ * @return Mage_Paybox_Model_System
+ */
+ public function getModel()
+ {
+ return Mage::getModel('paybox/system');
+ }
+
+ public function toOptionArray()
+ {
+ $cartTypesArr = array();
+ $tmpArr = $this->getModel()->getCartTypesByPayment($this->getModel()->getPaymentType());
+
+ foreach ($tmpArr as $code => $name) {
+ $cartTypesArr[] = array(
+ 'value' => $code,
+ 'label' => $name
+ );
+ }
+
+ return $cartTypesArr;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Source/Cctype.php b/app/code/core/Mage/Paybox/Model/Source/Cctype.php
new file mode 100644
index 0000000000..92628504b5
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Source/Cctype.php
@@ -0,0 +1,40 @@
+
+ */
+class Mage_Paybox_Model_Source_Cctype extends Mage_Payment_Model_Source_Cctype
+{
+ public function getAllowedTypes()
+ {
+ return array('VI', 'MC', 'AE', 'OT');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Source/Language.php b/app/code/core/Mage/Paybox/Model/Source/Language.php
new file mode 100644
index 0000000000..2dd1e95d18
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Source/Language.php
@@ -0,0 +1,50 @@
+
+ */
+class Mage_Paybox_Model_Source_Language
+{
+ public function toOptionArray()
+ {
+ return array(
+// array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH, 'label' => Mage::helper('paypal')->__('Authorization')),
+ array('value' => 'FRA', 'label' => Mage::helper('paybox')->__('FRA (French)')),
+ array('value' => 'GBR', 'label' => Mage::helper('paybox')->__('GBR (English)')),
+ array('value' => 'ESP', 'label' => Mage::helper('paybox')->__('ESP (Spanish)')),
+ array('value' => 'ITA', 'label' => Mage::helper('paybox')->__('ITA (Italian)')),
+ array('value' => 'DEU', 'label' => Mage::helper('paybox')->__('DEU (German)')),
+ array('value' => 'NLD', 'label' => Mage::helper('paybox')->__('NLD (Dutch)')),
+ array('value' => 'SWE', 'label' => Mage::helper('paybox')->__('SWE (Swedish)')),
+ );
+ }
+}
diff --git a/app/code/core/Mage/Paybox/Model/Source/ManagementMode.php b/app/code/core/Mage/Paybox/Model/Source/ManagementMode.php
new file mode 100644
index 0000000000..e88f064105
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Source/ManagementMode.php
@@ -0,0 +1,48 @@
+
+ */
+class Mage_Paybox_Model_Source_ManagementMode
+{
+ public function toOptionArray()
+ {
+ return array(
+// array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH, 'label' => Mage::helper('paypal')->__('Authorization')),
+ array('value' => 'A', 'label' => Mage::helper('paybox')->__('Mode A')),
+ array('value' => 'B', 'label' => Mage::helper('paybox')->__('Mode B')),
+ array('value' => 'C', 'label' => Mage::helper('paybox')->__('Mode C')),
+ array('value' => 'D', 'label' => Mage::helper('paybox')->__('Mode D')),
+ array('value' => 'E', 'label' => Mage::helper('paybox')->__('Mode E')),
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Source/MethodCall.php b/app/code/core/Mage/Paybox/Model/Source/MethodCall.php
new file mode 100644
index 0000000000..7629263003
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Source/MethodCall.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Paybox_Model_Source_MethodCall
+{
+ public function toOptionArray()
+ {
+ return array(
+// array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH, 'label' => Mage::helper('paypal')->__('Authorization')),
+ array('value' => 'GET', 'label' => Mage::helper('paybox')->__('GET')),
+ array('value' => 'POST', 'label' => Mage::helper('paybox')->__('POST')),
+ );
+ }
+}
diff --git a/app/code/core/Mage/Paybox/Model/Source/PaymentAction.php b/app/code/core/Mage/Paybox/Model/Source/PaymentAction.php
new file mode 100644
index 0000000000..5491fcda82
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Source/PaymentAction.php
@@ -0,0 +1,43 @@
+
+ */
+class Mage_Paybox_Model_Source_PaymentAction
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE, 'label' => Mage::helper('paybox')->__('Authorization')),
+ array('value' => Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE, 'label' => Mage::helper('paybox')->__('Payment')),
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Source/PaymentMode.php b/app/code/core/Mage/Paybox/Model/Source/PaymentMode.php
new file mode 100644
index 0000000000..deac42ec87
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Source/PaymentMode.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Paybox_Model_Source_PaymentMode
+{
+ public function toOptionArray()
+ {
+ return array(
+// array('value' => Mage_Paypal_Model_Api_Abstract::PAYMENT_TYPE_AUTH, 'label' => Mage::helper('paypal')->__('Authorization')),
+ array('value' => 1, 'label' => Mage::helper('paybox')->__('HTML form')),
+ array('value' => 4, 'label' => Mage::helper('paybox')->__('Command Line Mode')),
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/Source/PaymentType.php b/app/code/core/Mage/Paybox/Model/Source/PaymentType.php
new file mode 100644
index 0000000000..e39ccfcf4c
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/Source/PaymentType.php
@@ -0,0 +1,48 @@
+
+ */
+class Mage_Paybox_Model_Source_PaymentType
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => '', 'label' => Mage::helper('paybox')->__('--Please Select--')),
+ array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_CARTE, 'label' => Mage::helper('paybox')->__('CARTE')),
+ array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_SYMPASS, 'label' => Mage::helper('paybox')->__('SYMPASS')),
+ array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_PAYNOVA , 'label' => Mage::helper('paybox')->__('PAYNOVA')),
+ array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_TERMINEO, 'label' => Mage::helper('paybox')->__('TERMINEO')),
+ array('value' => Mage_Paybox_Model_System::PBX_PAYMENT_TYPE_PAYPAL, 'label' => Mage::helper('paybox')->__('PAYPAL')),
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/Model/System.php b/app/code/core/Mage/Paybox/Model/System.php
new file mode 100644
index 0000000000..21a43190a9
--- /dev/null
+++ b/app/code/core/Mage/Paybox/Model/System.php
@@ -0,0 +1,529 @@
+
+ */
+class Mage_Paybox_Model_System extends Mage_Payment_Model_Method_Abstract
+{
+ /**
+ * Paybox const variables
+ */
+ const PBX_FORM_HTML_METHOD = 1;
+ const PBX_COMMAND_LINE_METHOD = 4;
+
+ const PBX_METHOD_CALL = 'POST';
+
+ const PBX_PAYMENT_ACTION_ATHORIZE = 'O';
+ const PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE = 'N';
+
+ const PBX_PAYMENT_TYPE_CARTE = 'CARTE';
+ const PBX_PAYMENT_TYPE_SYMPASS = 'SYMPASS';
+ const PBX_PAYMENT_TYPE_PAYNOVA = 'PAYNOVA';
+ const PBX_PAYMENT_TYPE_TERMINEO = 'TERMINEO';
+ const PBX_PAYMENT_TYPE_PAYPAL = 'PAYPAL';
+
+ const PBX_CARTE_TYPE_CB = 'CB';
+ const PBX_CARTE_TYPE_VISA = 'VISA';
+ const PBX_CARTE_TYPE_EUROCARDMASTERCARD = 'EUROCARD_MASTERCARD';
+ const PBX_CARTE_TYPE_ECARD = 'E_CARD';
+ const PBX_CARTE_TYPE_AMEX = 'AMEX';
+ const PBX_CARTE_TYPE_DINERS = 'DINERS';
+ const PBX_CARTE_TYPE_JCB = 'JCB';
+ const PBX_CARTE_TYPE_AURORE = 'AURORE';
+ const PBX_CARTE_TYPE_PAYNOVA = 'PAYNOVA';
+ const PBX_CARTE_TYPE_TERMINEO = 'TERMINEO';
+ const PBX_CARTE_TYPE_PAYPAL = 'PAYPAL';
+
+ protected $_code = 'paybox_system';
+
+ protected $_isGateway = false;
+ protected $_canAuthorize = true;
+ protected $_canCapture = false;
+ protected $_canCapturePartial = false;
+ protected $_canRefund = false;
+ protected $_canVoid = false;
+ protected $_canUseInternal = false;
+ protected $_canUseCheckout = true;
+ protected $_canUseForMultishipping = false;
+
+ protected $_formBlockType = 'paybox/system_form';
+
+ protected $_order;
+ protected $_cartTypes;
+ protected $_currenciesNumbers;
+
+ /**
+ * Get order model
+ *
+ * @return Mage_Sales_Model_Order
+ */
+ public function getOrder()
+ {
+ if (!$this->_order) {
+ $paymentInfo = $this->getInfoInstance();
+ $this->_order = Mage::getModel('sales/order')
+ ->loadByIncrementId($paymentInfo->getOrder()->getRealOrderId());
+ }
+ return $this->_order;
+ }
+
+ /**
+ * Set order
+ *
+ * @param Mage_Sales_Model_Order $order
+ */
+ public function setOrder(Mage_Sales_Model_Order $order)
+ {
+ $this->_order = $order;
+ return $this;
+ }
+
+ /**
+ * Get cart types for all payment types
+ * or for given payment type
+ *
+ * @param string $paymentType
+ * @return array
+ */
+ protected function _getCartTypes($paymentType = null)
+ {
+ if (!$this->_cartTypes) {
+ $this->_cartTypes = array(
+ self::PBX_PAYMENT_TYPE_CARTE => array(
+ 'none' => Mage::helper('paybox')->__('Customer Choise'),
+ self::PBX_CARTE_TYPE_CB => Mage::helper('paybox')->__('CB'),
+ self::PBX_CARTE_TYPE_VISA => Mage::helper('paybox')->__('VISA'),
+ self::PBX_CARTE_TYPE_EUROCARDMASTERCARD => Mage::helper('paybox')->__('EUROCARD & MASTERCARD'),
+ self::PBX_CARTE_TYPE_ECARD => Mage::helper('paybox')->__('E CARD'),
+ self::PBX_CARTE_TYPE_AMEX => Mage::helper('paybox')->__('AMEX'),
+ self::PBX_CARTE_TYPE_DINERS => Mage::helper('paybox')->__('DINERS'),
+ self::PBX_CARTE_TYPE_JCB => Mage::helper('paybox')->__('JCB'),
+ self::PBX_CARTE_TYPE_AURORE => Mage::helper('paybox')->__('AURORE'),
+ ),
+ self::PBX_PAYMENT_TYPE_SYMPASS => array(
+ 'none' => Mage::helper('paybox')->__('Customer Choise'),
+ self::PBX_CARTE_TYPE_CB => Mage::helper('paybox')->__('CB'),
+ self::PBX_CARTE_TYPE_VISA => Mage::helper('paybox')->__('VISA'),
+ self::PBX_CARTE_TYPE_EUROCARDMASTERCARD => Mage::helper('paybox')->__('EUROCARD & MASTERCARD'),
+ self::PBX_CARTE_TYPE_ECARD => Mage::helper('paybox')->__('E CARD'),
+ self::PBX_CARTE_TYPE_AMEX => Mage::helper('paybox')->__('AMEX'),
+ self::PBX_CARTE_TYPE_DINERS => Mage::helper('paybox')->__('DINERS'),
+ self::PBX_CARTE_TYPE_JCB => Mage::helper('paybox')->__('JCB'),
+ self::PBX_CARTE_TYPE_AURORE => Mage::helper('paybox')->__('AURORE'),
+ ),
+ self::PBX_PAYMENT_TYPE_PAYNOVA => array(
+ self::PBX_CARTE_TYPE_PAYNOVA => Mage::helper('paybox')->__('PAYNOVA'),
+ ),
+ self::PBX_PAYMENT_TYPE_TERMINEO => array(
+ self::PBX_CARTE_TYPE_TERMINEO => Mage::helper('paybox')->__('TERMINEO'),
+ ),
+ self::PBX_PAYMENT_TYPE_PAYPAL => array(
+ self::PBX_CARTE_TYPE_PAYPAL => Mage::helper('paybox')->__('PAYPAL'),
+ )
+ );
+ }
+
+ if (!is_null($paymentType)) {
+ if (isset($this->_cartTypes[$paymentType])) {
+ return $this->_cartTypes[$paymentType];
+ }
+ }
+
+ return $this->_cartTypes;
+ }
+
+ /**
+ * Get cart types by given payment
+ *
+ * @param string $paymentType
+ * @return array
+ */
+ public function getCartTypesByPayment($paymentType)
+ {
+ if ($paymentType == '') {
+ return array();
+ }
+ return $this->_getCartTypes($paymentType);
+ }
+
+ /**
+ * Get all cart types in JSON format
+ *
+ * @return string
+ */
+ public function getJsonCartTypes()
+ {
+ return Mage::helper('core')->jsonEncode($this->_getCartTypes());
+ }
+
+ /**
+ * Get payment method
+ *
+ * @return string
+ */
+ public function getPaymentMethod()
+ {
+ return $this->getConfigData('pbx_mode');
+ }
+
+ /**
+ * Get name of executable file
+ *
+ * @return string
+ */
+ public function getPayboxFile()
+ {
+ return $this->getConfigData('pbx_file');
+ }
+
+ /**
+ * Get Payment type
+ *
+ * @return string
+ */
+ public function getPaymentType()
+ {
+ return $this->getConfigData('pbx_typepaiement');
+ }
+
+ /**
+ * Get Payment Action of Paybox System changed to Paybox specification
+ *
+ * @return string
+ */
+ public function getPaymentAction()
+ {
+ $paymentAction = $this->getConfigData('pbx_autoseule');
+ switch ($paymentAction) {
+ case self::ACTION_AUTHORIZE:
+ return self::PBX_PAYMENT_ACTION_ATHORIZE;
+ break;
+ case self::ACTION_AUTHORIZE_CAPTURE:
+ return self::PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE;
+ break;
+ default:
+ return self::PBX_PAYMENT_ACTION_ATHORIZE;
+ break;
+ }
+ }
+
+ /**
+ * Get cart type
+ *
+ * @return string
+ */
+ public function getCartType()
+ {
+ return $this->getConfigData('pbx_typecarte');
+ }
+
+ /**
+ * Get Site number (TPE)
+ *
+ * @return string
+ */
+ public function getSiteNumber()
+ {
+ return $this->getConfigData('pbx_site');
+ }
+
+ /**
+ * Get Rang number
+ *
+ * @return string
+ */
+ public function getRang()
+ {
+ return $this->getConfigData('pbx_rang');
+ }
+
+ /**
+ * Get Identifiant number
+ *
+ * @return string
+ */
+ public function getIdentifiant()
+ {
+ return $this->getConfigData('pbx_identifiant');
+ }
+
+ /**
+ * Get currency number in ISO4217 format
+ *
+ * @return string
+ */
+ public function getCurrencyNumber()
+ {
+ $currencyCode = $this->getOrder()->getBaseCurrencyCode();
+ if (!$this->_currenciesNumbers) {
+ $this->_currenciesNumbers = simplexml_load_file(Mage::getBaseDir().'/app/code/core/Mage/Paybox/etc/currency.xml');
+ }
+ if ($this->_currenciesNumbers->$currencyCode) {
+ return (string)$this->_currenciesNumbers->$currencyCode;
+ }
+ }
+
+ /**
+ * Get language of interface of payment defined in config
+ *
+ * @return string
+ */
+ public function getLanguage()
+ {
+ return $this->getConfigData('pbx_langue');
+ }
+
+ /**
+ * Get api urls if they defined in config
+ *
+ * @return unknown
+ */
+ public function getApiUrls()
+ {
+ $fielldsArr = array();
+ if (($primary = trim($this->getConfigData('pbx_paybox'))) != '') {
+ $fielldsArr['PBX_PAYBOX'] = $primary;
+ }
+
+ if (($backup1 = trim($this->getConfigData('pbx_backup1'))) != '') {
+ $fielldsArr['PBX_BACKUP1'] = $backup1;
+ }
+
+ if (($backup2 = trim($this->getConfigData('pbx_backup2'))) != '') {
+ $fielldsArr['PBX_BACKUP2'] = $backup2;
+ }
+
+ if (($backup3 = trim($this->getConfigData('pbx_backup3'))) != '') {
+ $fielldsArr['PBX_BACKUP3'] = $backup3;
+ }
+
+ return $fielldsArr;
+ }
+
+ /**
+ * Get timeouts for api urls if timeouts diferent from default
+ *
+ * @return array
+ */
+ public function getTimeouts()
+ {
+ $fielldsArr = array();
+ if (($timeout = trim($this->getConfigData('pbx_timeout'))) != '') {
+ $fielldsArr['PBX_TIMEOUT'] = $timeout;
+ }
+
+ if (($timeout1 = trim($this->getConfigData('pbx_timeout1'))) != '') {
+ $fielldsArr['PBX_TIMEOUT1'] = $timeout1;
+ }
+
+ if (($timeout2 = trim($this->getConfigData('pbx_timeout2'))) != '') {
+ $fielldsArr['PBX_TIMEOUT2'] = $timeout2;
+ }
+
+ if (($timeout3 = trim($this->getConfigData('pbx_timeout3'))) != '') {
+ $fielldsArr['PBX_TIMEOUT3'] = $timeout3;
+ }
+
+ return $fielldsArr;
+ }
+
+ /**
+ * Get params from config for HTML form mode
+ *
+ * @return array
+ */
+ public function getManagementMode()
+ {
+ $fieldsArr = array();
+ if (($text = trim($this->getConfigData('pbx_txt'))) != '') {
+ $fieldsArr['PBX_TXT'] = $text;
+ }
+
+ if (($wait = trim($this->getConfigData('pbx_wait'))) != '') {
+ $fieldsArr['PBX_WAIT'] = $wait;
+ }
+
+ if (($boutpi = trim($this->getConfigData('pbx_boutpi')))) {
+ $fieldsArr['PBX_BOUTPI'] = $boutpi;
+ }
+
+ if (($bkgd = trim($this->getConfigData('pbx_bkgd'))) != '') {
+ $fieldsArr['PBX_BKGD'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'payment/paybox/bkgd/' . $bkgd;
+ }
+
+ $fieldsArr['PBX_OUTPUT'] = $this->getConfigData('pbx_output');
+
+ return $fieldsArr;
+ }
+
+ /**
+ * Get ping flag (commandline mode)
+ *
+ * @return unknown
+ */
+ public function getPingFlag()
+ {
+ return $this->getConfigData('pbx_ping');
+ }
+
+ /**
+ * Get ping port (commandline mode)
+ *
+ * @return string
+ */
+ public function getPingPort()
+ {
+ return $this->getConfigData('pbx_port');
+ }
+
+ /**
+ * Get debug flag
+ *
+ * @return string
+ */
+ public function getDebugFlag()
+ {
+ return $this->getConfigData('debug_flag');
+ }
+
+ public function getOrderPlaceRedirectUrl()
+ {
+ if ($this->getPaymentMethod() == self::PBX_FORM_HTML_METHOD) {
+ return Mage::getUrl('paybox/system/redirect', array('_secure' => true));
+ } else {
+ return Mage::getUrl('paybox/system/commandline', array('_secure' => true));
+ }
+ }
+
+ /**
+ * Building array of params to send
+ *
+ * @return array
+ */
+ public function getFormFields()
+ {
+ $fieldsArr = array();
+
+ $fieldsArr = array(
+ 'PBX_MODE' => $this->getPaymentMethod(),
+ 'PBX_SITE' => $this->getSiteNumber(),//'1999888',
+ 'PBX_RANG' => $this->getRang(),//'99',
+ 'PBX_IDENTIFIANT' => $this->getIdentifiant(),//'2',
+ 'PBX_TOTAL' => ($this->getOrder()->getBaseGrandTotal()*100),
+ 'PBX_DEVISE' => $this->getCurrencyNumber(),
+ 'PBX_CMD' => $this->getOrder()->getRealOrderId(),
+ 'PBX_PORTEUR' => $this->getOrder()->getCustomerEmail(),
+ 'PBX_RETOUR' => 'amount:M;ref:R;auto:A;trans:T;error:E',
+ 'PBX_EFFECTUE' => Mage::getUrl('paybox/system/success', array('_secure' => true)),
+ 'PBX_REFUSE' => Mage::getUrl('paybox/system/refuse', array('_secure' => true)),
+ 'PBX_ANNULE' => Mage::getUrl('paybox/system/decline', array('_secure' => true)),
+ 'PBX_AUTOSEULE' => $this->getPaymentAction(),
+ 'PBX_LANGUE' => $this->getLanguage(),
+ 'PBX_ERREUR' => Mage::getUrl('paybox/system/error', array('_secure' => true)),
+ 'PBX_TYPEPAIEMENT' => $this->getPaymentType(),
+ 'PBX_TYPECARTE' => $this->getCartType(),
+ 'PBX_RUF1' => self::PBX_METHOD_CALL,
+ );
+
+ if (count($apiUrls = $this->getApiUrls())) {
+ $fieldsArr = array_merge($fieldsArr, $this->getApiUrls());
+ }
+ if (count($timeouts = $this->getTimeouts())) {
+ $fieldsArr = array_merge($fieldsArr, $this->getTimeouts());
+ }
+
+ if ($this->getPaymentMethod() == self::PBX_FORM_HTML_METHOD) {
+ $fieldsArr = array_merge($fieldsArr, $this->getManagementMode());
+ }
+
+ if ($this->getPaymentMethod() == self::PBX_COMMAND_LINE_METHOD && $this->getPingFlag()) {
+ $tmpFieldsArr['PBX_PING'] = '1';
+ if (($pingPort = trim($this->getPingPort())) != '') {
+ $tmpFieldsArr['PING_PORT'] = $pingPort;
+ }
+
+ $fieldsArr = array_merge($fieldsArr, $tmpFieldsArr);
+ }
+
+ if ($this->getDebugFlag()) {
+ $debug = Mage::getModel('paybox/api_debug')
+ ->setRealOrderId($this->getOrder()->getRealOrderId())
+ ->setRequestBody(print_r($fieldsArr, 1))
+ ->save();
+ }
+
+ return $fieldsArr;
+ }
+
+ /**
+ * Checking response
+ *
+ * @param array $response
+ * @return bool
+ */
+ public function checkResponse($response)
+ {
+ if ($this->getDebugFlag()) {
+ $debug = Mage::getModel('paybox/api_debug')
+ ->load($response['ref'], 'real_order_id')
+ ->setResponseBody(print_r($response, 1))
+ ->save();
+ }
+
+ if (isset($response['error'], $response['amount'],
+ $response['ref'], $response['trans'])
+ ) {
+ return true;
+ }
+ return false;
+ }
+
+ public function capture(Varien_Object $payment, $amount)
+ {
+ $payment->setStatus(self::STATUS_APPROVED)
+ ->setLastTransId($this->getTransactionId());
+ return $this;
+ }
+
+ public function authorize(Varien_Object $payment, $amount)
+ {
+ $payment->setStatus(self::STATUS_APPROVED)
+ ->setLastTransId($this->getTransactionId());
+
+ return $this;
+ }
+
+ public function cancel(Varien_Object $payment)
+ {
+ $payment->setStatus(self::STATUS_DECLINED);
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/controllers/SystemController.php b/app/code/core/Mage/Paybox/controllers/SystemController.php
new file mode 100644
index 0000000000..b454e68d46
--- /dev/null
+++ b/app/code/core/Mage/Paybox/controllers/SystemController.php
@@ -0,0 +1,364 @@
+
+ */
+class Mage_Paybox_SystemController extends Mage_Core_Controller_Front_Action
+{
+ protected $_payboxResponse = null;
+
+ protected $_responseStatus = false;
+
+ /**
+ * seting response after returning from paybox
+ *
+ * @param array $response
+ * @return object $this
+ */
+ protected function setPayboxResponse($response)
+ {
+ if (count($response)) {
+ $this->_payboxResponse = $response;
+ }
+ return $this;
+ }
+
+ /**
+ * Get System Model
+ *
+ * @return Mage_Paybox_Model_System
+ */
+ public function getModel()
+ {
+ return Mage::getSingleton('paybox/system');
+ }
+
+ /**
+ * Get Checkout Singleton
+ *
+ * @return Mage_Checkout_Model_Session
+ */
+ public function getCheckout()
+ {
+ return Mage::getSingleton('checkout/session');
+ }
+
+ /**
+ * Redirect action. Redirect customer to Paybox
+ *
+ */
+ public function redirectAction()
+ {
+ $session = $this->getCheckout();
+ $session->setPayboxQuoteId($session->getQuoteId());
+
+ $order = Mage::getModel('sales/order');
+ $order->loadByIncrementId($session->getLastRealOrderId());
+ $order->addStatusToHistory($order->getStatus(), $this->__('Customer was redirected to Paybox'));
+ $order->save();
+
+ $session->setPayboxOrderId(Mage::helper('core')->encrypt($session->getLastRealOrderId()));
+ $session->setPayboxPaymentAction(
+ $order->getPayment()->getMethodInstance()->getPaymentAction()
+ );
+
+ $this->getResponse()->setBody(
+ $this->getLayout()
+ ->createBlock('paybox/system_redirect')
+ ->setOrder($order)
+ ->toHtml()
+ );
+
+ $session->unsQuoteId();
+ }
+
+ /**
+ * Customer returning to this action if payment was successe
+ */
+ public function successAction()
+ {
+ $this->setPayboxResponse($this->getRequest()->getParams());
+ if ($this->_checkResponse()) {
+
+ $order = Mage::getModel('sales/order');
+ $order->loadByIncrementId($this->_payboxResponse['ref']);
+
+ if (!$order->getId()) {
+ Mage::throwException($this->__('There are no order.'));
+ }
+
+ if (Mage::helper('core')->decrypt($this->getCheckout()->getPayboxOrderId()) != $this->_payboxResponse['ref']) {
+ Mage::throwException($this->__('Order is not match.'));
+ }
+ $this->getCheckout()->unsPayboxOrderId();
+
+ if (($order->getBaseGrandTotal()*100) != $this->_payboxResponse['amount']) {
+ Mage::throwException($this->__('Amount is not match.'));
+ }
+
+ if ($this->_payboxResponse['error'] == '00000') {
+ $order->addStatusToHistory($order->getStatus(), $this->__('Customer successfully returned from Paybox'));
+
+ $redirectTo = 'checkout/onepage/success';
+ if ($this->getCheckout()->getPayboxPaymentAction() == Mage_Paybox_Model_System::PBX_PAYMENT_ACTION_ATHORIZE_CAPTURE) {
+ $this->getCheckout()->unsPayboxPaymentAction();
+ $order->getPayment()
+ ->getMethodInstance()
+ ->setTransactionId($this->_payboxResponse['trans']);
+ if ($this->_createInvoice($order)) {
+ $order->addStatusToHistory($order->getStatus(), $this->__('Invoice was create successfully'));
+ } else {
+ $order->addStatusToHistory($order->getStatus(), $this->__('Cann\'t create invoice'));
+ $redirectTo = '*/*/failure';
+ }
+ }
+
+ $session = $this->getCheckout();
+ $session->setQuoteId($session->getPayboxQuoteId(true));
+ $session->getQuote()->setIsActive(false)->save();
+ $session->unsPayboxQuoteId();
+ } else {
+ $redirectTo = '*/*/failure';
+ $order->cancel();
+ $order->addStatusToHistory($order->getStatus(), $this->__('Customer was rejected by Paybox'));
+ }
+
+ $order->sendNewOrderEmail();
+ $order->save();
+
+ $this->_redirect($redirectTo);
+ } else {
+ $this->norouteAction();
+ return;
+ }
+ }
+
+ /**
+ * Action when payment was declined by Paybox
+ */
+ public function refuseAction()
+ {
+ $this->setPayboxResponse($this->getRequest()->getParams());
+ if ($this->_checkResponse()) {
+ $this->getCheckout()->unsPayboxQuoteId();
+ $this->getCheckout()->setPayboxErrorMessage('Order was canceled by Paybox');
+
+ $order = Mage::getModel('sales/order')
+ ->loadByIncrementId($this->_payboxResponse['ref']);
+ $order->cancel();
+ $order->addStatusToHistory($order->getStatus(), $this->__('Customer was refuse by Paybox'));
+ $order->save();
+
+ $this->_redirect('*/*/failure');
+ } else {
+ $this->norouteAction();
+ return;
+ }
+ }
+
+ /**
+ * Action when customer cancele payment or press button to back to shop
+ */
+ public function declineAction()
+ {
+ $this->setPayboxResponse($this->getRequest()->getParams());
+ if ($this->_checkResponse()) {
+
+ $order = Mage::getModel('sales/order')
+ ->loadByIncrementId($this->_payboxResponse['ref']);
+ $order->cancel();
+ $order->addStatusToHistory($order->getStatus(), $this->__('Order was canceled by customer'));
+ $order->save();
+
+ $session = $this->getCheckout();
+ $session->setQuoteId($session->getPayboxQuoteId(true));
+ $session->getQuote()->setIsActive(false)->save();
+ $session->unsPayboxQuoteId();
+
+ $this->_redirect('checkout/cart');
+ } else {
+ $this->norouteAction();
+ return;
+ }
+ }
+
+ /**
+ * Redirect action. Redirect to Paybox using commandline mode
+ *
+ */
+ public function commandlineAction()
+ {
+ $session = $this->getCheckout();
+ $session->setPayboxQuoteId($session->getQuoteId());
+
+ $order = Mage::getModel('sales/order')
+ ->loadByIncrementId($this->getCheckout()->getLastRealOrderId());
+ $order->addStatusToHistory(
+ $order->getStatus(), $this->__('Customer was redirected to Paybox using \'command line\' mode')
+ );
+ $order->save();
+
+ $session->setPayboxOrderId(Mage::helper('core')->encrypt($session->getLastRealOrderId()));
+ $session->setPayboxPaymentAction(
+ $order->getPayment()->getMethodInstance()->getPaymentAction()
+ );
+
+ $session->unsQuoteId();
+
+ $payment = $order->getPayment()->getMethodInstance();
+ $fieldsArr = $payment->getFormFields();
+ $paramStr = '';
+ foreach ($fieldsArr as $k => $v) {
+ $paramStr .= $k.'='.$v.' ';
+ }
+
+ $paramStr = str_replace(';', '\;', $paramStr);
+ $result = shell_exec(Mage::getBaseDir().'/'.$this->getModel()->getPayboxFile().' '.$paramStr);
+
+ if (isset($fieldsArr['PBX_PING']) && $fieldsArr['PBX_PING'] == '1') {
+ $fieldsArr['PBX_PING'] = '0';
+ $fieldsArr['PBX_PAYBOX'] = trim(substr($result, strpos($result, 'http')));
+ $paramStr = '';
+ foreach ($fieldsArr as $k => $v) {
+ $paramStr .= $k.'='.$v.' ';
+ }
+
+ $paramStr = str_replace(';', '\;', $paramStr);
+ $result = shell_exec(Mage::getBaseDir().'/'.$this->getModel()->getPayboxFile().' '.$paramStr);
+ }
+
+ $this->loadLayout(false);
+ $this->getResponse()->setBody($result);
+ $this->renderLayout();
+ }
+
+ /**
+ * Error action. If request params to Paybox has mistakes
+ *
+ */
+ public function errorAction()
+ {
+ if (!$this->getCheckout()->getPayboxQuoteId()) {
+ $this->norouteAction();
+ return;
+ }
+
+ $session = $this->getCheckout();
+ $session->setQuoteId($session->getPayboxQuoteId(true));
+ $session->getQuote()->setIsActive(false)->save();
+ $session->unsPayboxQuoteId();
+
+ if (!$this->getRequest()->getParam('NUMERR')) {
+ $this->norouteAction();
+ return;
+ }
+
+ $this->loadLayout();
+
+ $this->getCheckout()
+ ->setPayboxErrorNumber(
+ $this->getRequest()->getParam('NUMERR')
+ );
+
+ $this->renderLayout();
+ }
+
+ /**
+ * Failure action.
+ * Displaying information if customer was redirecting to cancel or decline actions
+ *
+ */
+ public function failureAction()
+ {
+ if (!$this->getCheckout()->getPayboxErrorMessage()) {
+ $this->norouteAction();
+ return;
+ }
+
+ $this->loadLayout();
+ $this->renderLayout();
+ }
+
+ /**
+ * Checking response and Paybox session variables
+ *
+ * @return unknown
+ */
+ protected function _checkResponse()
+ {
+ if (!$this->getCheckout()->getPayboxQuoteId()) {
+ $this->norouteAction();
+ return;
+ }
+
+ if (!$this->getCheckout()->getPayboxOrderId()) {
+ $this->norouteAction();
+ return;
+ }
+
+ if (!$this->getCheckout()->getPayboxPaymentAction()) {
+ $this->norouteAction();
+ return;
+ }
+
+ if (!$this->_payboxResponse) {
+ return false;
+ }
+
+ //check for valid response
+ if ($this->getModel()->checkResponse($this->_payboxResponse)) {
+ return true;
+ }
+
+ return true;
+ }
+
+ /**
+ * Creating invoice
+ *
+ * @param Mage_Sales_Model_Order $order
+ * @return bool
+ */
+ protected function _createInvoice(Mage_Sales_Model_Order $order)
+ {
+ if ($order->canInvoice()) {
+ $invoice = $order->prepareInvoice();
+ $invoice->register()->capture();
+ Mage::getModel('core/resource_transaction')
+ ->addObject($invoice)
+ ->addObject($invoice->getOrder())
+ ->save();
+ return true;
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/etc/config.xml b/app/code/core/Mage/Paybox/etc/config.xml
new file mode 100644
index 0000000000..a8407c1809
--- /dev/null
+++ b/app/code/core/Mage/Paybox/etc/config.xml
@@ -0,0 +1,133 @@
+
+
+
+
+
+ 0.1.3
+
+
+
+
+
+ Mage_Paybox_Model
+ paybox_mysql4
+
+
+ Mage_Paybox_Model_Mysql4
+
+
+
+
+
+
+
+
+
+ Mage_Paybox
+ Mage_Paybox_Model_Mysql4_Setup
+
+
+ core_setup
+
+
+
+
+ core_write
+
+
+
+
+ core_read
+
+
+
+
+ Mage_Paybox_Block
+
+
+
+
+
+ standard
+
+ Mage_Paybox
+ paybox
+
+
+
+
+
+
+
+ Mage_Paybox.csv
+
+
+
+
+
+
+
+
+
+
+ Mage_Paybox.csv
+
+
+
+
+
+
+
+
+ 1
+
+
+
+ authorize
+ E
+ FRA
+ paybox/system
+ Paybox System
+ processing
+ 0
+
+
+
+
+
+ authorize
+ paybox/direct
+ Paybox Direct
+ 1
+ processing
+ AE,VI,MC,DI
+ 0
+
+
+
+
diff --git a/app/code/core/Mage/Paybox/etc/currency.xml b/app/code/core/Mage/Paybox/etc/currency.xml
new file mode 100644
index 0000000000..7f8fc2000c
--- /dev/null
+++ b/app/code/core/Mage/Paybox/etc/currency.xml
@@ -0,0 +1,209 @@
+
+
+
+
+ 971
+ 008
+ 012
+ 840
+ 978
+ 973
+ 951
+ 032
+ 051
+ 533
+ 036
+ 944
+ 044
+ 048
+ 050
+ 052
+ 974
+ 084
+ 952
+ 060
+ 356
+ 064
+ 068
+ 984
+ 977
+ 072
+ 578
+ 986
+ 096
+ 975
+ 108
+ 116
+ 950
+ 124
+ 132
+ 136
+ 152
+ 156
+ 170
+ 174
+ 976
+ 554
+ 188
+ 191
+ 192
+ 203
+ 208
+ 262
+ 214
+ 818
+ 222
+ 232
+ 233
+ 230
+ 238
+ 242
+ 953
+ 270
+ 981
+ 936
+ 292
+ 320
+ 324
+ 328
+ 332
+ 340
+ 344
+ 348
+ 352
+ 360
+ 960
+ 364
+ 368
+ 376
+ 388
+ 392
+ 400
+ 398
+ 404
+ 408
+ 410
+ 414
+ 417
+ 418
+ 428
+ 422
+ 710
+ 426
+ 430
+ 434
+ 756
+ 440
+ 446
+ 807
+ 969
+ 454
+ 458
+ 462
+ 478
+ 480
+ 484
+ 979
+ 498
+ 496
+ 504
+ 943
+ 104
+ 516
+ 524
+ 532
+ 558
+ 566
+ 512
+ 586
+ 590
+ 598
+ 600
+ 604
+ 608
+ 985
+ 634
+ 946
+ 643
+ 646
+ 654
+ 882
+ 678
+ 682
+ 941
+ 690
+ 694
+ 702
+ 703
+ 090
+ 706
+ 144
+ 938
+ 968
+ 748
+ 752
+ 948
+ 947
+ 760
+ 901
+ 972
+ 834
+ 764
+ 776
+ 780
+ 788
+ 949
+ 795
+ 800
+ 980
+ 784
+ 826
+ 998
+ 997
+ 858
+ 940
+ 860
+ 548
+ 937
+ 704
+ 886
+ 894
+ 716
+ 959
+ 955
+ 956
+ 957
+ 958
+ 964
+ 962
+ 961
+ Nil
+ Nil
+ 963
+ 999
+
diff --git a/app/code/core/Mage/Paybox/etc/system.xml b/app/code/core/Mage/Paybox/etc/system.xml
new file mode 100644
index 0000000000..8f19c7f2e6
--- /dev/null
+++ b/app/code/core/Mage/Paybox/etc/system.xml
@@ -0,0 +1,459 @@
+
+
+
+
+
+
+
+ Paybox System
+ text
+ 101
+ 1
+ 1
+ 1
+
+
+ Enabled
+ select
+ adminhtml/system_config_source_yesno
+ 1
+ 1
+ 1
+ 0
+
+
+ Paybox CGI file
+ text
+ 5
+ 1
+ 1
+ 0
+
+
+ Mode of retrieval of information
+ select
+ paybox/source_paymentMode
+ 10
+ 1
+ 1
+ 0
+
+
+ Payment Action
+ select
+ paybox/source_paymentAction
+ 15
+ 1
+ 1
+ 0
+
+
+ Site number (TPE)
+ obscure
+ adminhtml/system_config_backend_encrypted
+ 20
+ 1
+ 1
+ 0
+
+
+ Rank number
+ obscure
+ adminhtml/system_config_backend_encrypted
+ 30
+ 1
+ 1
+ 0
+
+
+ PAYBOX identifier
+ obscure
+ adminhtml/system_config_backend_encrypted
+ 40
+ 1
+ 1
+ 0
+
+
+ Management mode of the intermediary page
+ Only if you HTML From mode selected
+ select
+ paybox/source_managementMode
+ 50
+ 1
+ 1
+ 0
+
+
+ Text on the intermediary page
+ Only if you HTML From mode selected
+ text
+ 60
+ 1
+ 1
+ 0
+
+
+ Name of the button on the intermediary page
+ Only if you HTML From mode selected
+ text
+ 70
+ 1
+ 1
+ 0
+
+
+ Screen background of the intermediary page
+ Only if you HTML From mode selected
+ image
+ adminhtml/system_config_backend_image
+ payment/paybox/bkgd
+ payment/paybox/bkgd
+ 80
+ 1
+ 1
+ 0
+
+
+ Delay in displaying the intermediary page (in msec)
+ Only if you HTML From mode selected
+ text
+ 90
+ 1
+ 1
+ 0
+
+
+ Language of the payment page
+ select
+ paybox/source_language
+ 100
+ 1
+ 1
+ 0
+
+
+ Payment Type
+ select
+ paybox/source_paymentType
+ 105
+ 1
+ 1
+ 0
+
+
+ Cart Type
+ select
+ paybox/adminhtml_cart_type
+ paybox/source_cartType
+ 108
+ 1
+ 1
+ 0
+
+
+ The URL of the primary payment server
+ Specify the URL of the primary payment server if different from default
+ text
+ 110
+ 1
+ 1
+ 0
+
+
+ Timeout for checking
+ Time-out (in seconds) to check the avalaibility of the primary payment server (Default 8 seconds)
+ text
+ 115
+ 1
+ 1
+ 0
+
+
+ The URL of the primary backup payment server
+ Specify the URL of the primary backup payment server if different from default
+ text
+ 120
+ 1
+ 1
+ 0
+
+
+ Timeout for checking
+ Time-out (in seconds) to check the avalaibility of the primary backup payment server (Default 10 seconds)
+ text
+ 125
+ 1
+ 1
+ 0
+
+
+ The URL of the second backup payment server
+ Specify the URL of the second backup payment server if different from default
+ text
+ 130
+ 1
+ 1
+ 0
+
+
+ Timeout for checking
+ Time-out (in seconds) to check the avalaibility of the second backup payment server (Default 20 seconds)
+ text
+ 135
+ 1
+ 1
+ 0
+
+
+ The URL of the third backup payment server
+ Specify the URL of the third backup payment server if different from default
+ text
+ 140
+ 1
+ 1
+ 0
+
+
+ Timeout for checking
+ Time-out (in seconds) to check the avalaibility of the third backup payment server (Default 20 seconds)
+ text
+ 145
+ 1
+ 1
+ 0
+
+
+ Ping Flag
+ Only with 'Command Line' mode
+ select
+ adminhtml/system_config_source_yesno
+ 160
+ 1
+ 1
+ 0
+
+
+ TCP Port
+ TCP Port used to check the availability of a payment server if Ping Flag enabled (Default port is 443)
+ text
+ 170
+ 1
+ 1
+ 0
+
+
+ Debug Flag
+ select
+ adminhtml/system_config_source_yesno
+ 300
+ 1
+ 1
+ 0
+
+
+ Title
+ text
+ 310
+ 1
+ 1
+ 1
+
+
+ New order status
+ select
+ adminhtml/system_config_source_order_status_processing
+ 320
+ 1
+ 1
+ 0
+
+
+ Sort order
+ text
+ 500
+ 1
+ 1
+ 0
+
+
+ Payment from applicable countries
+ allowspecific
+ 330
+ adminhtml/system_config_source_payment_allspecificcountries
+ 1
+ 1
+ 0
+
+
+ Payment from Specific countries
+ multiselect
+ 340
+ adminhtml/system_config_source_country
+ 1
+ 1
+ 0
+
+
+
+
+ Paybox Direct
+ text
+ 101
+ 1
+ 1
+ 1
+
+
+ Enabled
+ select
+ adminhtml/system_config_source_yesno
+ 1
+ 1
+ 1
+ 0
+
+
+ Site number (TPE)
+ obscure
+ adminhtml/system_config_backend_encrypted
+ 20
+ 1
+ 1
+ 0
+
+
+ Rank number
+ obscure
+ adminhtml/system_config_backend_encrypted
+ 30
+ 1
+ 1
+ 0
+
+
+ Activated Key
+ obscure
+ adminhtml/system_config_backend_encrypted
+ 40
+ 1
+ 1
+ 0
+
+
+ The URL of the primary payment server
+ text
+ 50
+ 1
+ 1
+ 0
+
+
+ The URL of the backup payment server
+ text
+ 60
+ 1
+ 1
+ 0
+
+
+ Debug Flag
+ select
+ adminhtml/system_config_source_yesno
+ 70
+ 1
+ 1
+ 0
+
+
+ Title
+ text
+ 80
+ 1
+ 1
+ 1
+
+
+ New order status
+ select
+ adminhtml/system_config_source_order_status_processing
+ 90
+ 1
+ 1
+ 0
+
+
+ Payment Action
+ select
+ paybox/source_paymentAction
+ 95
+ 1
+ 1
+ 0
+
+
+ Credit Card Types
+ multiselect
+ paybox/source_cctype
+ 100
+ 1
+ 1
+ 0
+
+
+ Payment from applicable countries
+ allowspecific
+ 110
+ adminhtml/system_config_source_payment_allspecificcountries
+ 1
+ 1
+ 0
+
+
+ Payment from Specific countries
+ multiselect
+ 120
+ adminhtml/system_config_source_country
+ 1
+ 1
+ 0
+
+
+ Sort order
+ text
+ 500
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-install-0.1.0.php
new file mode 100644
index 0000000000..cdfc810e60
--- /dev/null
+++ b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-install-0.1.0.php
@@ -0,0 +1,47 @@
+startSetup();
+
+$installer->run("
+
+DROP TABLE IF EXISTS `{$this->getTable('paybox/api_debug')}`;
+CREATE TABLE `{$this->getTable('paybox/api_debug')}` (
+ `debug_id` int(10) unsigned NOT NULL auto_increment,
+ `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `real_order_id` varchar(50)NOT NULL default '',
+ `request_body` text,
+ `response_body` text,
+ PRIMARY KEY (`debug_id`),
+ KEY `debug_at` (`debug_at`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+ ");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.0-0.1.1.php b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.0-0.1.1.php
new file mode 100644
index 0000000000..dd3e7058c6
--- /dev/null
+++ b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.0-0.1.1.php
@@ -0,0 +1,33 @@
+startSetup();
+
+$installer->addAttribute('order_payment', 'paybox_request_number', array());
+
+$installer->endSetup();
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.1-0.1.2.php b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.1-0.1.2.php
new file mode 100644
index 0000000000..56139488ab
--- /dev/null
+++ b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.1-0.1.2.php
@@ -0,0 +1,44 @@
+startSetup();
+
+$installer->run("
+
+DROP TABLE IF EXISTS `{$this->getTable('paybox/question_number')}`;
+CREATE TABLE `{$this->getTable('paybox/question_number')}` (
+ `account_id` int(10) unsigned NOT NULL auto_increment,
+ `account_hash` varchar(50) NOT NULL default '',
+ `increment_value` int(10) unsigned NOT NULL default 1,
+ `reset_date` timestamp NOT NULL default CURRENT_TIMESTAMP,
+ PRIMARY KEY (`account_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+");
+
+$installer->endSetup();
\ No newline at end of file
diff --git a/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.2-0.1.3.php b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.2-0.1.3.php
new file mode 100644
index 0000000000..1b425ad932
--- /dev/null
+++ b/app/code/core/Mage/Paybox/sql/paybox_setup/mysql4-upgrade-0.1.2-0.1.3.php
@@ -0,0 +1,33 @@
+startSetup();
+
+$installer->addAttribute('order_payment', 'paybox_question_number', array());
+
+$installer->endSetup();
\ No newline at end of file
diff --git a/app/code/core/Mage/Paygate/Model/Authorizenet.php b/app/code/core/Mage/Paygate/Model/Authorizenet.php
index ea1298c895..361c78afe8 100644
--- a/app/code/core/Mage/Paygate/Model/Authorizenet.php
+++ b/app/code/core/Mage/Paygate/Model/Authorizenet.php
@@ -102,53 +102,49 @@ public function canUseForCurrency($currencyCode)
/**
* Send authorize request to gateway
*
- * @param Varien_Object $payment
- * @param decimal $amount
- * @return Mage_Paygate_Model_Authorizenet
+ * @param Varien_Object $payment
+ * @param decimal $amount
+ * @return Mage_Paygate_Model_Authorizenet
+ * @throws Mage_Core_Exception
*/
public function authorize(Varien_Object $payment, $amount)
{
- $error = false;
-
- if($amount>0){
- $payment->setAnetTransType(self::REQUEST_TYPE_AUTH_ONLY);
- $payment->setAmount($amount);
-
- $request= $this->_buildRequest($payment);
- $result = $this->_postRequest($request);
-
- $payment->setCcApproval($result->getApprovalCode())
- ->setLastTransId($result->getTransactionId())
- ->setCcTransId($result->getTransactionId())
- ->setCcAvsStatus($result->getAvsResultCode())
- ->setCcCidStatus($result->getCardCodeResponseCode());
-
- switch ($result->getResponseCode()) {
- case self::RESPONSE_CODE_APPROVED:
- $payment->setStatus(self::STATUS_APPROVED);
- break;
- case self::RESPONSE_CODE_DECLINED:
- $error = Mage::helper('paygate')->__('Payment authorization transaction has been declined.');
- break;
- default:
- $error = Mage::helper('paygate')->__('Payment authorization error.');
- break;
- }
- }else{
- $error = Mage::helper('paygate')->__('Invalid amount for authorization.');
+ if ($amount <= 0) {
+ Mage::throwException(Mage::helper('paygate')->__('Invalid amount for authorization.'));
}
+ $payment->setAnetTransType(self::REQUEST_TYPE_AUTH_ONLY);
+ $payment->setAmount($amount);
+
+ $request= $this->_buildRequest($payment);
+ $result = $this->_postRequest($request);
- if ($error !== false) {
- Mage::throwException($error);
+ $payment->setCcApproval($result->getApprovalCode())
+ ->setLastTransId($result->getTransactionId())
+ ->setCcTransId($result->getTransactionId())
+ ->setCcAvsStatus($result->getAvsResultCode())
+ ->setCcCidStatus($result->getCardCodeResponseCode());
+
+ switch ($result->getResponseCode()) {
+ case self::RESPONSE_CODE_APPROVED:
+ $payment->setStatus(self::STATUS_APPROVED);
+ return $this;
+ case self::RESPONSE_CODE_DECLINED:
+ Mage::throwException(Mage::helper('paygate')->__('Payment authorization transaction has been declined.'));
+ default:
+ Mage::throwException(Mage::helper('paygate')->__('Payment authorization error.'));
}
- return $this;
}
-
+ /**
+ * Send capture request to gateway
+ *
+ * @param Varien_Object $payment
+ * @param decimal $amount
+ * @return Mage_Paygate_Model_Authorizenet
+ * @throws Mage_Core_Exception
+ */
public function capture(Varien_Object $payment, $amount)
{
- $error = false;
-
if ($payment->getCcTransId()) {
$payment->setAnetTransType(self::REQUEST_TYPE_PRIOR_AUTH_CAPTURE);
} else {
@@ -164,68 +160,50 @@ public function capture(Varien_Object $payment, $amount)
$payment->setStatus(self::STATUS_APPROVED);
//$payment->setCcTransId($result->getTransactionId());
$payment->setLastTransId($result->getTransactionId());
+ return $this;
}
- else {
- if ($result->getResponseReasonText()) {
- $error = $result->getResponseReasonText();
- }
- else {
- $error = Mage::helper('paygate')->__('Error in capturing the payment');
- }
- }
-
- if ($error !== false) {
- Mage::throwException($error);
+ if ($result->getResponseReasonText()) {
+ Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText()));
}
-
- return $this;
+ Mage::throwException(Mage::helper('paygate')->__('Error in capturing the payment'));
}
/**
- * void
+ * Void the payment through gateway
*
- * @author Magento Core Team
- * @access public
- * @param string $payment Varien_Object object
- * @return Mage_Payment_Model_Abstract
+ * @param Varien_Object $payment
+ * @return Mage_Paygate_Model_Authorizenet
+ * @throws Mage_Core_Exception
*/
public function void(Varien_Object $payment)
{
- $error = false;
- if($payment->getVoidTransactionId()){
+ if ($payment->getVoidTransactionId()) {
$payment->setAnetTransType(self::REQUEST_TYPE_VOID);
$request = $this->_buildRequest($payment);
$request->setXTransId($payment->getVoidTransactionId());
$result = $this->_postRequest($request);
- if($result->getResponseCode()==self::RESPONSE_CODE_APPROVED){
+ if ($result->getResponseCode()==self::RESPONSE_CODE_APPROVED) {
$payment->setStatus(self::STATUS_SUCCESS );
+ return $this;
}
- else{
- $payment->setStatus(self::STATUS_ERROR);
- $error = $result->getResponseReasonText();
- }
- }else{
$payment->setStatus(self::STATUS_ERROR);
- $error = Mage::helper('paygate')->__('Invalid transaction id');
+ Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText()));
}
- if ($error !== false) {
- Mage::throwException($error);
- }
- return $this;
+ $payment->setStatus(self::STATUS_ERROR);
+ Mage::throwException(Mage::helper('paygate')->__('Invalid transaction id'));
}
/**
* refund the amount with transaction id
*
- * @access public
* @param string $payment Varien_Object object
- * @return Mage_Payment_Model_Abstract
+ * @return Mage_Paygate_Model_Authorizenet
+ * @throws Mage_Core_Exception
*/
public function refund(Varien_Object $payment, $amount)
{
- $error = false;
- if ($payment->getRefundTransactionId() && $amount>0) {
+ if ($payment->getRefundTransactionId() && $amount > 0) {
$payment->setAnetTransType(self::REQUEST_TYPE_CREDIT);
$request = $this->_buildRequest($payment);
$request->setXTransId($payment->getRefundTransactionId());
@@ -233,18 +211,11 @@ public function refund(Varien_Object $payment, $amount)
if ($result->getResponseCode()==self::RESPONSE_CODE_APPROVED) {
$payment->setStatus(self::STATUS_SUCCESS);
- } else {
- $error = $result->getResponseReasonText();
+ return $this;
}
-
- } else {
- $error = Mage::helper('paygate')->__('Error in refunding the payment');
+ Mage::throwException($this->_wrapGatewayError($result->getResponseReasonText()));
}
-
- if ($error !== false) {
- Mage::throwException($error);
- }
- return $this;
+ Mage::throwException(Mage::helper('paygate')->__('Error in refunding the payment'));
}
/**
@@ -408,9 +379,7 @@ protected function _postRequest(Varien_Object $request)
->setResultDump(print_r($result->getData(),1))
->save();
}
- Mage::throwException(
- Mage::helper('paygate')->__('Gateway request error: %s', $e->getMessage())
- );
+ Mage::throwException($this->_wrapGatewayError($e->getMessage()));
}
$responseBody = $response->getBody();
@@ -450,4 +419,15 @@ protected function _postRequest(Varien_Object $request)
return $result;
}
+
+ /**
+ * Gateway response wrapper
+ *
+ * @param string $text
+ * @return string
+ */
+ protected function _wrapGatewayError($text)
+ {
+ return Mage::helper('paygate')->__('Gateway error: %s', $text);
+ }
}
diff --git a/app/code/core/Mage/Paygate/Model/Payflow/Pro.php b/app/code/core/Mage/Paygate/Model/Payflow/Pro.php
index 1aaca5cc14..d31aec6a02 100644
--- a/app/code/core/Mage/Paygate/Model/Payflow/Pro.php
+++ b/app/code/core/Mage/Paygate/Model/Payflow/Pro.php
@@ -129,6 +129,21 @@ public function authorize(Varien_Object $payment, $amount)
return $this;
}
+ /**
+ * Check capture availability
+ * To avoid capture already voided transactions, allow only one capture thus the method
+ * cannot make capture partially
+ *
+ * @return bool
+ */
+ public function canCapture()
+ {
+ if ($this->getInfoInstance()->getOrder()->getBaseSubtotalInvoiced() > 0) {
+ return false;
+ }
+ return true;
+ }
+
public function capture(Varien_Object $payment, $amount)
{
$error = false;
diff --git a/app/code/core/Mage/Payment/Model/Info.php b/app/code/core/Mage/Payment/Model/Info.php
index d3c01caf95..709ae496cd 100644
--- a/app/code/core/Mage/Payment/Model/Info.php
+++ b/app/code/core/Mage/Payment/Model/Info.php
@@ -73,7 +73,7 @@ public function getMethodInstance()
} else {
return $this->_getData('method_instance');
}
- Mage::throwException(Mage::helper('payment')->__('Can not retrieve payment method instance'));
+ Mage::throwException(Mage::helper('payment')->__('Cannot retrieve payment method instance'));
}
/**
diff --git a/app/code/core/Mage/Payment/Model/Method/Cc.php b/app/code/core/Mage/Payment/Model/Method/Cc.php
index a7b6c0f822..0311ccbf2d 100644
--- a/app/code/core/Mage/Payment/Model/Method/Cc.php
+++ b/app/code/core/Mage/Payment/Model/Method/Cc.php
@@ -144,7 +144,7 @@ public function validate()
if (!$info->getCcCid() || !$regExp || !preg_match($regExp ,$info->getCcCid())){
$errorMsg = $this->_getHelper()->__('Please enter a valid credit card verification number.');
}
- }
+ }
if($errorMsg){
Mage::throwException($errorMsg);
@@ -170,7 +170,7 @@ public function getVerificationRegEx()
'MC' => '/^[0-9]{3}$/', // Master Card
'AE' => '/^[0-9]{4}$/', // American Express
'DI' => '/^[0-9]{3}$/', // Discovery
- 'SS' => '/^[0-9]{4}$/',
+ 'SS' => '/^[0-9]{3,4}$/',
'OT' => '/^[0-9]{3,4}$/'
);
return $verificationExpList;
@@ -184,7 +184,7 @@ protected function _validateExpDate($expYear, $expMonth)
}
return true;
}
-
+
public function OtherCcType($type)
{
return $type=='OT';
diff --git a/app/code/core/Mage/Paypal/Model/Standard.php b/app/code/core/Mage/Paypal/Model/Standard.php
index e77e3d8453..a5c7e2e50a 100644
--- a/app/code/core/Mage/Paypal/Model/Standard.php
+++ b/app/code/core/Mage/Paypal/Model/Standard.php
@@ -389,12 +389,6 @@ public function ipnPostSubmit()
}
*/
- // get from config order status to be set
- $newOrderStatus = $this->getConfigData('order_status', $order->getStoreId());
- if (empty($newOrderStatus)) {
- $newOrderStatus = $order->getStatus();
- }
-
/*
if payer_status=verified ==> transaction in sale mode
if transactin in sale mode, we need to create an invoice
@@ -426,6 +420,10 @@ public function ipnPostSubmit()
);
}
} else {
+ $newOrderStatus = $this->getConfigData('order_status', $order->getStoreId());
+ if (empty($newOrderStatus)) {
+ $newOrderStatus = true;
+ }
$order->setState(
Mage_Sales_Model_Order::STATE_PROCESSING, $newOrderStatus,
Mage::helper('paypal')->__('Received IPN verification'),
diff --git a/app/code/core/Mage/PaypalUk/Block/Direct/Form.php b/app/code/core/Mage/PaypalUk/Block/Direct/Form.php
index 499054d453..a5c0d36d70 100644
--- a/app/code/core/Mage/PaypalUk/Block/Direct/Form.php
+++ b/app/code/core/Mage/PaypalUk/Block/Direct/Form.php
@@ -19,26 +19,21 @@
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
- * @package Mage_Paypal
+ * @package Mage_PaypalUk
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
-
+/**
+ * UK domestic cards specific information block
+ */
class Mage_PaypalUk_Block_Direct_Form extends Mage_Payment_Block_Form_Cc
{
- protected function _construct()
- {
- parent::_construct();
- $this->setTemplate('paypaluk/direct/form.phtml');
- }
-
protected function _getDirect()
{
return Mage::getSingleton('paypaluk/direct');
}
-
/**
* Retrieve availables credit card types
*
@@ -93,4 +88,19 @@ public function hasSsCardType()
return false;
}
+ /**
+ * Add UK domestic cards additional fields as child block
+ *
+ * Forks a clone, but with a different form
+ *
+ * @return Mage_PaypalUk_Block_Direct_Form
+ */
+ public function _beforeToHtml()
+ {
+ $child = clone $this;
+ $this->setChild('uk_domestic',
+ $child->setTemplate('paypaluk/direct/form.phtml')
+ );
+ return parent::_beforeToHtml();
+ }
}
\ No newline at end of file
diff --git a/app/code/core/Mage/PaypalUk/controllers/ExpressController.php b/app/code/core/Mage/PaypalUk/controllers/ExpressController.php
index caff3eacda..858b27d311 100644
--- a/app/code/core/Mage/PaypalUk/controllers/ExpressController.php
+++ b/app/code/core/Mage/PaypalUk/controllers/ExpressController.php
@@ -71,6 +71,11 @@ public function shortcutAction()
$this->getResponse()->setRedirect($this->getExpress()->getRedirectUrl());
}
+ public function editAction()
+ {
+ $this->getResponse()->setRedirect($this->getExpress()->getApi()->getPaypalUrl());
+ }
+
/*
* when a user click on cancel on paypal need to redirect them to shopping cart
*/
diff --git a/app/code/core/Mage/PaypalUk/etc/config.xml b/app/code/core/Mage/PaypalUk/etc/config.xml
index 917a58142a..8199705649 100644
--- a/app/code/core/Mage/PaypalUk/etc/config.xml
+++ b/app/code/core/Mage/PaypalUk/etc/config.xml
@@ -78,7 +78,7 @@
SS
- Switch/Solo
+ Maestro/Solo
40
diff --git a/app/code/core/Mage/Protx/Block/Standard/Failure.php b/app/code/core/Mage/Protx/Block/Standard/Failure.php
new file mode 100644
index 0000000000..79250b8a17
--- /dev/null
+++ b/app/code/core/Mage/Protx/Block/Standard/Failure.php
@@ -0,0 +1,56 @@
+
+ */
+
+class Mage_Protx_Block_Standard_Failure extends Mage_Core_Block_Template
+{
+ /**
+ * Return StatusDetail field value from Response
+ *
+ * @return string
+ */
+ public function getErrorMessage ()
+ {
+ $error = Mage::getSingleton('checkout/session')->getErrorMessage();
+ Mage::getSingleton('checkout/session')->unsErrorMessage();
+ return $error;
+ }
+
+ /**
+ * Get continue shopping url
+ */
+ public function getContinueShoppingUrl()
+ {
+ return Mage::getUrl('checkout/cart');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/Block/Standard/Form.php b/app/code/core/Mage/Protx/Block/Standard/Form.php
new file mode 100644
index 0000000000..eae3318aec
--- /dev/null
+++ b/app/code/core/Mage/Protx/Block/Standard/Form.php
@@ -0,0 +1,43 @@
+
+ */
+
+class Mage_Protx_Block_Standard_Form extends Mage_Payment_Block_Form
+{
+ protected function _construct()
+ {
+ $this->setTemplate('protx/standard/form.phtml');
+ parent::_construct();
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/Block/Standard/Redirect.php b/app/code/core/Mage/Protx/Block/Standard/Redirect.php
new file mode 100644
index 0000000000..fffc3518cb
--- /dev/null
+++ b/app/code/core/Mage/Protx/Block/Standard/Redirect.php
@@ -0,0 +1,58 @@
+
+ */
+
+class Mage_Protx_Block_Standard_Redirect extends Mage_Core_Block_Abstract
+{
+ protected function _toHtml()
+ {
+ $standard = Mage::getModel('protx/standard');
+ $form = new Varien_Data_Form();
+ $form->setAction($standard->getProtxUrl())
+ ->setId('protx_standard_checkout')
+ ->setName('protx_standard_checkout')
+ ->setMethod('POST')
+ ->setUseContainer(true);
+ foreach ($standard->setOrder($this->getOrder())->getStandardCheckoutFormFields() as $field => $value) {
+ $form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
+ }
+ $html = '';
+ $html.= $this->__('You will be redirected to protx in a few seconds.');
+ $html.= $form->toHtml();
+ $html.= '';
+ $html.= '';
+
+ return $html;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/Helper/Data.php b/app/code/core/Mage/Protx/Helper/Data.php
new file mode 100644
index 0000000000..01b46bd4b2
--- /dev/null
+++ b/app/code/core/Mage/Protx/Helper/Data.php
@@ -0,0 +1,38 @@
+
+ */
+class Mage_Protx_Helper_Data extends Mage_Core_Helper_Abstract
+{
+
+}
diff --git a/app/code/core/Mage/Protx/Model/Api/Debug.php b/app/code/core/Mage/Protx/Model/Api/Debug.php
new file mode 100644
index 0000000000..18fa88127c
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Api/Debug.php
@@ -0,0 +1,41 @@
+
+ */
+class Mage_Protx_Model_Api_Debug extends Mage_Core_Model_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('protx/api_debug');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/Model/Config.php b/app/code/core/Mage/Protx/Model/Config.php
new file mode 100644
index 0000000000..874ea9eda5
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Config.php
@@ -0,0 +1,179 @@
+
+ */
+
+class Mage_Protx_Model_Config extends Varien_Object
+{
+ const MODE_SIMULATOR = 'SIMULATOR';
+ const MODE_TEST = 'TEST';
+ const MODE_LIVE = 'LIVE';
+
+ const PAYMENT_TYPE_PAYMENT = 'PAYMENT';
+ const PAYMENT_TYPE_DEFERRED = 'DEFERRED';
+ const PAYMENT_TYPE_AUTHENTICATE = 'AUTHENTICATE';
+ const PAYMENT_TYPE_AUTHORISE = 'AUTHORISE';
+
+
+ /**
+ * Return config var
+ *
+ * @param string Var key
+ * @param string Default value for non-existing key
+ * @return mixed
+ */
+ public function getConfigData($key, $default=false)
+ {
+ if (!$this->hasData($key)) {
+ $value = Mage::getStoreConfig('payment/protx_standard/'.$key);
+ if (is_null($value) || false===$value) {
+ $value = $default;
+ }
+ $this->setData($key, $value);
+ }
+ return $this->getData($key);
+ }
+
+ /**
+ * Return Protocol version
+ *
+ * @return string Protocol version
+ */
+ public function getVersion ()
+ {
+ return '2.22';
+ }
+
+ /**
+ * Return Store description sent to Protx
+ *
+ * @return string Description
+ */
+ public function getDescription ()
+ {
+ return $this->getConfigData('description');
+ }
+
+ /**
+ * Return Protx registered merchant account name
+ *
+ * @return string Merchant account name
+ */
+ public function getVendorName ()
+ {
+ return $this->getConfigData('vendor_name');
+ }
+
+ /**
+ * Return Protx merchant password
+ *
+ * @return string Merchant password
+ */
+ public function getVendorPassword ()
+ {
+ return $this->getConfigData('vendor_password');
+ }
+
+ /**
+ * Return preferred payment type (see SELF::PAYMENT_TYPE_* constants)
+ *
+ * @return string payment type
+ */
+ public function getPaymentType ()
+ {
+ return $this->getConfigData('payment_action');
+ }
+
+ /**
+ * Return working mode (see SELF::MODE_* constants)
+ *
+ * @return string Working mode
+ */
+ public function getMode ()
+ {
+ return $this->getConfigData('mode');
+ }
+
+ /**
+ * Return new order status
+ *
+ * @return string New order status
+ */
+ public function getNewOrderStatus ()
+ {
+ return $this->getConfigData('order_status');
+ }
+
+ /**
+ * Return debug flag
+ *
+ * @return boolean Debug flag (0/1)
+ */
+ public function getDebug ()
+ {
+ return $this->getConfigData('debug_flag');
+ }
+
+ /**
+ * Return key for simple XOR crypt, using Vendor encrypted password by Protx
+ *
+ * @return string Key for simple XOR crypt
+ */
+ public function getCryptKey ()
+ {
+ return $this->getVendorPassword();
+ }
+
+ /**
+ * Returns status of vendore notification
+ *
+ * @return bool
+ */
+ public function getVendorNotification()
+ {
+ return $this->getConfigData('vendor_notification');
+ }
+
+ /**
+ * Returns status of vendore email
+ *
+ * @return bool
+ */
+ public function getVendorEmail()
+ {
+ if ($email = $this->getConfigData('vendor_email')) {
+ return $email;
+ } else {
+ return Mage::getStoreConfig('trans_email/ident_general/email');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug.php b/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug.php
new file mode 100644
index 0000000000..0d2e690ee2
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug.php
@@ -0,0 +1,42 @@
+
+ */
+
+class Mage_Protx_Model_Mysql4_Api_Debug extends Mage_Core_Model_Mysql4_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('protx/api_debug', 'transaction_id');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug/Collection.php b/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug/Collection.php
new file mode 100644
index 0000000000..ecdaea09bf
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Mysql4/Api/Debug/Collection.php
@@ -0,0 +1,41 @@
+
+ */
+class Mage_Protx_Model_Mysql4_Api_Debug_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('protx/api_debug');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/Model/Mysql4/Setup.php b/app/code/core/Mage/Protx/Model/Mysql4/Setup.php
new file mode 100644
index 0000000000..6cfe88156d
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Mysql4/Setup.php
@@ -0,0 +1,39 @@
+
+ */
+
+class Mage_Protx_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup
+{
+
+}
diff --git a/app/code/core/Mage/Protx/Model/Session.php b/app/code/core/Mage/Protx/Model/Session.php
new file mode 100644
index 0000000000..90f3f5f940
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Session.php
@@ -0,0 +1,42 @@
+
+ */
+
+class Mage_Protx_Model_Session extends Mage_Core_Model_Session_Abstract
+{
+ public function __construct()
+ {
+ $this->init('protx');
+ }
+}
diff --git a/app/code/core/Mage/Protx/Model/Source/ModeAction.php b/app/code/core/Mage/Protx/Model/Source/ModeAction.php
new file mode 100644
index 0000000000..e8165b89c5
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Source/ModeAction.php
@@ -0,0 +1,49 @@
+
+ */
+
+class Mage_Protx_Model_Source_ModeAction
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => Mage_Protx_Model_Config::MODE_SIMULATOR, 'label' => Mage::helper('protx')->__('Simulator')),
+ array('value' => Mage_Protx_Model_Config::MODE_TEST, 'label' => Mage::helper('protx')->__('Test')),
+ array('value' => Mage_Protx_Model_Config::MODE_LIVE, 'label' => Mage::helper('protx')->__('Live')),
+ );
+ }
+}
+
+
+
diff --git a/app/code/core/Mage/Protx/Model/Source/PaymentAction.php b/app/code/core/Mage/Protx/Model/Source/PaymentAction.php
new file mode 100644
index 0000000000..2db2366dce
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Source/PaymentAction.php
@@ -0,0 +1,46 @@
+
+ */
+
+class Mage_Protx_Model_Source_PaymentAction
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => Mage_Protx_Model_Config::PAYMENT_TYPE_PAYMENT, 'label' => Mage::helper('protx')->__('PAYMENT')),
+ array('value' => Mage_Protx_Model_Config::PAYMENT_TYPE_DEFERRED, 'label' => Mage::helper('protx')->__('DEFERRED')),
+ array('value' => Mage_Protx_Model_Config::PAYMENT_TYPE_AUTHENTICATE, 'label' => Mage::helper('protx')->__('AUTHENTICATE')),
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/Model/Standard.php b/app/code/core/Mage/Protx/Model/Standard.php
new file mode 100644
index 0000000000..ed08bf96f9
--- /dev/null
+++ b/app/code/core/Mage/Protx/Model/Standard.php
@@ -0,0 +1,456 @@
+
+ */
+class Mage_Protx_Model_Standard extends Mage_Payment_Model_Method_Abstract
+{
+ protected $_code = 'protx_standard';
+ protected $_formBlockType = 'protx/standard_form';
+
+ protected $_isGateway = false;
+ protected $_canAuthorize = true;
+ protected $_canCapture = true;
+ protected $_canCapturePartial = false;
+ protected $_canRefund = false;
+ protected $_canVoid = false;
+ protected $_canUseInternal = false;
+ protected $_canUseCheckout = true;
+ protected $_canUseForMultishipping = false;
+
+ protected $_order = null;
+
+
+ /**
+ * Get Config model
+ *
+ * @return object Mage_Protx_Model_Config
+ */
+ public function getConfig()
+ {
+ return Mage::getSingleton('protx/config');
+ }
+
+ /**
+ * Return debug flag
+ *
+ * @return boolean
+ */
+ public function getDebug ()
+ {
+ return $this->getConfig()->getDebug();
+ }
+
+ /**
+ * Returns Target URL
+ *
+ * @return string Target URL
+ */
+ public function getProtxUrl ()
+ {
+ switch ($this->getConfig()->getMode()) {
+ case Mage_Protx_Model_Config::MODE_LIVE:
+ $url = 'https://ukvps.protx.com/vspgateway/service/vspform-register.vsp';
+ break;
+ case Mage_Protx_Model_Config::MODE_TEST:
+ $url = 'https://ukvpstest.protx.com/vspgateway/service/vspform-register.vsp';
+ break;
+ default: // simulator mode
+ $url = 'https://ukvpstest.protx.com/VSPSimulator/VSPFormGateway.asp';
+ break;
+ }
+ return $url;
+ }
+
+ /**
+ * Return URL for Protx success response
+ *
+ * @return string URL
+ */
+ protected function getSuccessURL ()
+ {
+ return Mage::getUrl('protx/standard/successresponse');
+ }
+
+ /**
+ * Return URL for Protx failure response
+ *
+ * @return string URL
+ */
+ protected function getFailureURL ()
+ {
+ return Mage::getUrl('protx/standard/failureresponse');
+ }
+
+ /**
+ * Transaction unique ID sent to Protx and sent back by Protx for order restore
+ * Using created order ID
+ *
+ * @return string Transaction unique number
+ */
+ protected function getVendorTxCode ()
+ {
+ return $this->getOrder()->getRealOrderId();
+ }
+
+ /**
+ * Returns cart formatted
+ * String format:
+ * Number of lines:Name1:Quantity1:CostNoTax1:Tax1:CostTax1:Total1:Name2:Quantity2:CostNoTax2...
+ *
+ * @return string Formatted cart items
+ */
+ protected function getFormattedCart ()
+ {
+ $items = $this->getOrder()->getAllItems();
+ $resultParts = array();
+ $totalLines = 0;
+ if ($items) {
+ foreach($items as $item) {
+ if ($item->getParentItem()) {
+ continue;
+ }
+ $quantity = $item->getQtyOrdered();
+
+ $cost = sprintf('%.2f', $item->getBasePrice() - $item->getBaseDiscountAmount());
+ $tax = sprintf('%.2f', $item->getBaseTaxAmount());
+ $costPlusTax = sprintf('%.2f', $cost + $tax/$quantity);
+
+ $totalCostPlusTax = sprintf('%.2f', $quantity * $cost + $tax);
+
+ $resultParts[] = str_replace(':', ' ', $item->getName());
+ $resultParts[] = $quantity;
+ $resultParts[] = $cost;
+ $resultParts[] = $tax;
+ $resultParts[] = $costPlusTax;
+ $resultParts[] = $totalCostPlusTax;
+ $totalLines++; //counting actual formatted items
+ }
+ }
+
+ // add delivery
+ $shipping = $this->getOrder()->getBaseShippingAmount();
+ if ((int)$shipping > 0) {
+ $totalLines++;
+ $resultParts = array_merge($resultParts, array('Shipping','','','','',sprintf('%.2f', $shipping)));
+ }
+
+ $result = $totalLines . ':' . implode(':', $resultParts);
+ return $result;
+ }
+
+ /**
+ * Format Crypted string with all order data for request to Protx
+ *
+ * @return string Crypted string
+ */
+ protected function getCrypted ()
+ {
+ $order = $this->getOrder();
+ if (!($order instanceof Mage_Sales_Model_Order)) {
+ Mage::throwException($this->_getHelper()->__('Cannot retrieve order object'));
+ }
+
+ $shipping = $order->getShippingAddress();
+ $billing = $order->getBillingAddress();
+
+ $amount = $order->getBaseGrandTotal();
+
+ $currency = $order->getBaseCurrencyCode();
+
+ $queryPairs = array();
+
+ $transactionId = $this->getVendorTxCode();
+ $queryPairs['VendorTxCode'] = $transactionId;
+
+
+ $queryPairs['Amount'] = sprintf('%.2f', $amount);
+ $queryPairs['Currency'] = $currency;
+
+ // Up to 100 chars of free format description
+ $description = $this->getConfig()->getDescription() != ''
+ ? $this->getConfig()->getDescription()
+ : Mage::app()->getStore()->getName() . ' ' . ' payment';
+ $queryPairs['Description'] = $description;
+
+ $queryPairs['SuccessURL'] = $this->getSuccessURL();
+ $queryPairs['FailureURL'] = $this->getFailureURL();
+
+ $queryPairs['CustomerName'] = $billing->getFirstname().' '.$billing->getLastname();
+ $queryPairs['CustomerEMail'] = $order->getCustomerEmail();
+ $queryPairs['ContactNumber'] = $billing->getTelephone();
+ $queryPairs['ContactFax'] = $billing->getFax();
+
+ if ($this->getConfig()->getVendorNotification()) {
+ $queryPairs['VendorEMail'] = $this->getConfig()->getVendorEmail();
+ } else {
+ $queryPairs['VendorEMail'] = '';
+ }
+
+ $queryPairs['eMailMessage'] = '';
+
+ $queryPairs['BillingAddress'] = $billing->format('oneline');
+ $queryPairs['BillingPostCode'] = $billing->getPostcode();
+
+ if ($shipping) {
+ $queryPairs['DeliveryAddress'] = $shipping->getFormated();
+ $queryPairs['DeliveryPostCode'] = $shipping->getPostcode();
+ } else {
+ $queryPairs['DeliveryAddress'] = '';
+ $queryPairs['DeliveryPostCode'] = '';
+ }
+
+ $queryPairs['Basket'] = $this->getFormattedCart();
+
+ // For charities registered for Gift Aid
+ $queryPairs['AllowGiftAid'] = '0';
+
+ /**
+ * Allow fine control over AVS/CV2 checks and rules by changing this value. 0 is Default
+ * It can be changed dynamically, per transaction, if you wish. See the VSP Server Protocol document
+ */
+ if ($this->getConfig()->getPaymentType() !== Mage_Protx_Model_Config::PAYMENT_TYPE_AUTHENTICATE) {
+ $queryPairs['ApplyAVSCV2'] = '0';
+ }
+
+ /**
+ * Allow fine control over 3D-Secure checks and rules by changing this value. 0 is Default
+ * It can be changed dynamically, per transaction, if you wish. See the VSP Server Protocol document
+ */
+ $queryPairs['Apply3DSecure'] = '0';
+
+ if ($this->getDebug()) {
+ Mage::getModel('protx/api_debug')
+ ->setRequestBody($this->getProtxUrl()."\n".print_r($queryPairs,1))
+ ->save();
+ }
+
+ // Encrypt the plaintext string for inclusion in the hidden field
+ $result = $this->arrayToCrypt($queryPairs);
+ return $result;
+ }
+
+ /**
+ * Form block description
+ *
+ * @return object
+ */
+ public function createFormBlock($name)
+ {
+ $block = $this->getLayout()->createBlock('protx/form_standard', $name);
+ $block->setMethod($this->_code);
+ $block->setPayment($this->getPayment());
+ return $block;
+ }
+
+ /**
+ * Return Order Place Redirect URL
+ *
+ * @return string Order Redirect URL
+ */
+ public function getOrderPlaceRedirectUrl()
+ {
+ return Mage::getUrl('protx/standard/redirect');
+ }
+
+ /**
+ * Return encrypted string with simple XOR algorithm
+ *
+ * @param string String to be encrypted
+ * @return string Encrypted string
+ */
+ protected function simpleXOR ($string)
+ {
+ $result = '';
+ $cryptKey = $this->getConfig()->getCryptKey();
+
+ if (!$cryptKey) {
+ return $string;
+ }
+
+ // Initialise key array
+ $keyList = array();
+
+ // Convert $cryptKey into array of ASCII values
+ for($i = 0; $i < strlen($cryptKey); $i++){
+ $keyList[$i] = ord(substr($cryptKey, $i, 1));
+ }
+
+ // Step through string a character at a time
+ for($i = 0; $i < strlen($string); $i++) {
+ /**
+ * Get ASCII code from string, get ASCII code from key (loop through with MOD),
+ * XOR the two, get the character from the result
+ * % is MOD (modulus), ^ is XOR
+ */
+ $result .= chr(ord(substr($string, $i, 1)) ^ ($keyList[$i % strlen($cryptKey)]));
+ }
+ return $result;
+ }
+
+ /**
+ * Extract possible response values into array from query string
+ *
+ * @param string Query string i.e. var1=value1&var2=value3...
+ * @return array
+ */
+ protected function getToken($queryString) {
+
+ // List the possible tokens
+ $Tokens = array(
+ "Status",
+ "StatusDetail",
+ "VendorTxCode",
+ "VPSTxId",
+ "TxAuthNo",
+ "Amount",
+ "AVSCV2",
+ "AddressResult",
+ "PostCodeResult",
+ "CV2Result",
+ "GiftAid",
+ "3DSecureStatus",
+ "CAVV"
+ );
+
+ // Initialise arrays
+ $output = array();
+ $resultArray = array();
+
+ // Get the next token in the sequence
+ $c = count($Tokens);
+ for ($i = $c - 1; $i >= 0 ; $i--){
+ // Find the position in the string
+ $start = strpos($queryString, $Tokens[$i]);
+ // If it's present
+ if ($start !== false){
+ // Record position and token name
+ $resultArray[$i]['start'] = $start;
+ $resultArray[$i]['token'] = $Tokens[$i];
+ }
+ }
+
+ // Sort in order of position
+ sort($resultArray);
+
+ // Go through the result array, getting the token values
+ $c = count($resultArray);
+ for ($i = 0; $i < $c; $i++){
+ // Get the start point of the value
+ $valueStart = $resultArray[$i]['start'] + strlen($resultArray[$i]['token']) + 1;
+ // Get the length of the value
+ if ($i == $c-1) {
+ $output[$resultArray[$i]['token']] = substr($queryString, $valueStart);
+ } else {
+ $valueLength = $resultArray[$i+1]['start'] - $resultArray[$i]['start'] - strlen($resultArray[$i]['token']) - 2;
+ $output[$resultArray[$i]['token']] = substr($queryString, $valueStart, $valueLength);
+ }
+
+ }
+
+ return $output;
+ }
+
+ /**
+ * Convert array (key => value, key => value, ...) to crypt string
+ *
+ * @param array Array to be converted
+ * @return string Crypt string
+ */
+ public function arrayToCrypt ($array)
+ {
+ $parts = array();
+ if (is_array($array)) {
+ foreach ($array as $k => $v) {
+ $parts[] = $k . '=' . $v;
+ }
+ }
+ $result = implode('&', $parts);
+ $result = $this->simpleXOR($result);
+ $result = $this->base64Encode($result);
+ return $result;
+ }
+
+ /**
+ * Reverse arrayToCrypt
+ *
+ * @param string Crypt string
+ * @return array
+ */
+ public function cryptToArray ($crypted)
+ {
+ $decoded = $this->base64Decode($crypted);
+ $uncrypted = $this->simpleXOR($decoded);
+ $tokens = $this->getToken($uncrypted);
+ return $tokens;
+ }
+
+ /**
+ * Custom base64_encode()
+ *
+ * @param String
+ * @return String
+ */
+ protected function base64Encode($plain)
+ {
+ return base64_encode($plain);
+ }
+
+ /**
+ * Custom base64_decode()
+ *
+ * @param String
+ * @return String
+ */
+ protected function base64Decode($scrambled)
+ {
+ // Fix plus to space conversion issue
+ $scrambled = str_replace(" ","+",$scrambled);
+ return base64_decode($scrambled);
+ }
+
+ /**
+ * Return Standard Checkout Form Fields for request to Protx
+ *
+ * @return array Array of hidden form fields
+ */
+ public function getStandardCheckoutFormFields ()
+ {
+ $fields = array(
+ 'VPSProtocol' => $this->getConfig()->getVersion(),
+ 'TxType' => $this->getConfig()->getPaymentType(),
+ 'Vendor' => $this->getConfig()->getVendorName(),
+ 'Crypt' => $this->getCrypted()
+ );
+ return $fields;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/controllers/StandardController.php b/app/code/core/Mage/Protx/controllers/StandardController.php
new file mode 100644
index 0000000000..3d0e81df4a
--- /dev/null
+++ b/app/code/core/Mage/Protx/controllers/StandardController.php
@@ -0,0 +1,279 @@
+
+ */
+class Mage_Protx_StandardController extends Mage_Core_Controller_Front_Action
+{
+ public $isValidResponse = false;
+
+ /**
+ * Get singleton with protx strandard
+ *
+ * @return object Mage_Protx_Model_Standard
+ */
+ public function getStandard()
+ {
+ return Mage::getSingleton('protx/standard');
+ }
+
+ /**
+ * Get Config model
+ *
+ * @return object Mage_Protx_Model_Config
+ */
+ public function getConfig()
+ {
+ return $this->getStandard()->getConfig();
+ }
+
+ /**
+ * Return debug flag
+ *
+ * @return boolean
+ */
+ public function getDebug ()
+ {
+ return $this->getStandard()->getDebug();
+ }
+
+ /**
+ * When a customer chooses Protx on Checkout/Payment page
+ *
+ */
+ public function redirectAction()
+ {
+ $session = Mage::getSingleton('checkout/session');
+ $session->setProtxStandardQuoteId($session->getQuoteId());
+
+ $order = Mage::getModel('sales/order');
+ $order->loadByIncrementId($session->getLastRealOrderId());
+ $order->addStatusToHistory(
+ $order->getStatus(),
+ Mage::helper('protx')->__('Customer was redirected to Protx')
+ );
+ $order->save();
+
+ $this->getResponse()
+ ->setBody($this->getLayout()
+ ->createBlock('protx/standard_redirect')
+ ->setOrder($order)
+ ->toHtml());
+
+ $session->unsQuoteId();
+ }
+
+ /**
+ * Success response from Protx
+ */
+ public function successResponseAction()
+ {
+ $this->preResponse();
+
+ if (!$this->isValidResponse) {
+ $this->_redirect('');
+ return ;
+ }
+
+ $transactionId = $this->responseArr['VendorTxCode'];
+
+ if ($this->getDebug()) {
+ Mage::getModel('protx/api_debug')
+ ->setResponseBody(print_r($this->responseArr,1))
+ ->save();
+ }
+
+ $order = Mage::getModel('sales/order');
+ $order->loadByIncrementId($transactionId);
+
+ if (!$order->getId()) {
+ /*
+ * need to have logic when there is no order with the order id from protx
+ */
+ return false;
+ }
+
+ $order->addStatusToHistory(
+ $order->getStatus(),
+ Mage::helper('protx')->__('Customer successfully returned from Protx')
+ );
+
+ $order->sendNewOrderEmail();
+
+ $this->responseArr['Amount'] = str_replace(',', '', $this->responseArr['Amount']);
+
+ if (sprintf('%.2f', $this->responseArr['Amount']) != sprintf('%.2f', $order->getBaseGrandTotal())) {
+ // cancel order
+ $order->cancel();
+ $order->addStatusToHistory(
+ $order->getStatus(),
+ Mage::helper('protx')->__('Order total amount does not match protx gross total amount')
+ );
+ } else {
+ $order->getPayment()->setTransactionId($this->responseArr['VPSTxId']);
+
+ if ($this->getConfig()->getPaymentType() == Mage_Protx_Model_Config::PAYMENT_TYPE_PAYMENT) {
+ if ($this->saveInvoice($order)) {
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
+ } else {
+ $newOrderStatus = $this->getConfig()->getNewOrderStatus() ?
+ $this->getConfig()->getNewOrderStatus() : Mage_Sales_Model_Order::STATE_NEW;
+ }
+ } else {
+ $order->addStatusToHistory(
+ $order->getStatus(),
+ Mage::helper('protx')->__($this->responseArr['StatusDetail'])
+ );
+ }
+ }
+
+ $order->save();
+
+ $session = Mage::getSingleton('checkout/session');
+ $session->setQuoteId($session->getProtxStandardQuoteId(true));
+ Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
+ $this->_redirect('checkout/onepage/success');
+ }
+
+ /**
+ * Save invoice for order
+ *
+ * @param Mage_Sales_Model_Order $order
+ * @return boolean Can save invoice or not
+ */
+ protected function saveInvoice (Mage_Sales_Model_Order $order)
+ {
+ if ($order->canInvoice()) {
+ $invoice = $order->prepareInvoice();
+
+ $invoice->register()->capture();
+ Mage::getModel('core/resource_transaction')
+ ->addObject($invoice)
+ ->addObject($invoice->getOrder())
+ ->save();
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Failure response from Protx
+ */
+ public function failureResponseAction ()
+ {
+ $this->preResponse();
+
+ if (!$this->isValidResponse) {
+ $this->_redirect('');
+ return ;
+ }
+
+ $transactionId = $this->responseArr['VendorTxCode'];
+
+ if ($this->getDebug()) {
+ Mage::getModel('protx/api_debug')
+ ->setResponseBody(print_r($this->responseArr,1))
+ ->save();
+ }
+
+ $order = Mage::getModel('sales/order');
+ $order->loadByIncrementId($transactionId);
+
+ if (!$order->getId()) {
+ /**
+ * need to have logic when there is no order with the order id from protx
+ */
+ return false;
+ }
+
+ // cancel order in anyway
+ $order->cancel();
+
+ $session = Mage::getSingleton('checkout/session');
+ $session->setQuoteId($session->getProtxStandardQuoteId(true));
+
+ // Customer clicked CANCEL Butoon
+ if ($this->responseArr['Status'] == 'ABORT') {
+ $history = Mage::helper('protx')->__('Order '.$order->getId().' was canceled by customer');
+ $redirectTo = 'checkout/cart';
+ } else {
+ $history = Mage::helper('protx')->__($this->responseArr['StatusDetail']);
+ $session->setErrorMessage($this->responseArr['StatusDetail']);
+ $redirectTo = 'protx/standard/failure';
+ }
+
+ $history = Mage::helper('protx')->__('Customer was returned from Protx.') . ' ' . $history;
+ $order->addStatusToHistory($order->getStatus(), $history);
+ $order->save();
+
+ $this->_redirect($redirectTo);
+ }
+
+ /**
+ * Expected GET HTTP Method
+ */
+ protected function preResponse ()
+ {
+ $responseCryptString = $this->getRequest()->crypt;
+
+ if ($responseCryptString != '') {
+ $rArr = $this->getStandard()->cryptToArray($responseCryptString);
+ $ok = is_array($rArr)
+ && isset($rArr['Status']) && $rArr['Status'] != ''
+ && isset($rArr['VendorTxCode']) && $rArr['VendorTxCode'] != ''
+ && isset($rArr['Amount']) && $rArr['Amount'] != '';
+
+ if ($ok) {
+ $this->responseArr = $rArr;
+ $this->isValidResponse = true;
+ }
+ }
+ }
+
+ /**
+ * Failure Action
+ */
+ public function failureAction ()
+ {
+ $session = Mage::getSingleton('checkout/session');
+
+ if (!$session->getErrorMessage()) {
+ $this->_redirect('checkout/cart');
+ return;
+ }
+
+ $this->loadLayout();
+ $this->_initLayoutMessages('protx/session');
+ $this->renderLayout();
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/etc/config.xml b/app/code/core/Mage/Protx/etc/config.xml
new file mode 100644
index 0000000000..2274dee2c5
--- /dev/null
+++ b/app/code/core/Mage/Protx/etc/config.xml
@@ -0,0 +1,122 @@
+
+
+
+
+
+ 0.1.0
+
+
+
+
+
+ Mage_Protx_Model
+ protx_mysql4
+
+
+ Mage_Protx_Model_Mysql4
+
+
+
+
+
+
+
+
+ Mage_Protx
+
+
+ core_setup
+
+
+
+
+ core_write
+
+
+
+
+ core_read
+
+
+
+
+ Mage_Protx_Block
+
+
+
+
+ /protx/standard
+
+
+
+ standard
+
+ Mage_Protx
+ protx
+
+
+
+
+
+
+
+ Mage_Protx.csv
+
+
+
+
+
+
+
+ protx.xml
+
+
+
+
+
+
+
+
+
+ Mage_Protx.csv
+
+
+
+
+
+
+
+
+ Payment
+ protx/standard
+ Protx Standard
+ 0
+
+
+
+
diff --git a/app/code/core/Mage/Protx/etc/system.xml b/app/code/core/Mage/Protx/etc/system.xml
new file mode 100644
index 0000000000..4b5e76a3e7
--- /dev/null
+++ b/app/code/core/Mage/Protx/etc/system.xml
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+ Protx Standard
+ text
+ 101
+ 1
+ 1
+ 1
+
+
+ Enabled
+ select
+ adminhtml/system_config_source_yesno
+ 1
+ 1
+ 1
+ 0
+
+
+ Payment Action
+ select
+ protx/source_paymentAction
+ 2
+ 1
+ 1
+ 0
+
+
+ Title
+ text
+ 3
+ 1
+ 1
+ 1
+
+
+ Transaction Description
+ Store name will be used if left empty
+ text
+ 3
+ 1
+ 1
+ 0
+
+
+ New order status
+ select
+ adminhtml/system_config_source_order_status_processing
+ 4
+ 1
+ 1
+ 0
+
+
+ Vendor name
+ text
+ 5
+ 1
+ 1
+ 0
+
+
+ Vendor encrypted password
+ text
+ 6
+ 1
+ 1
+ 0
+
+
+ Vendor email notification
+ select
+ adminhtml/system_config_source_yesno
+ 7
+ 1
+ 1
+ 0
+
+
+ Vendor email
+ 'General contact' email will be used if left empty
+ text
+ 8
+ 1
+ 1
+ 0
+
+
+ Mode
+ select
+ protx/source_modeAction
+ 9
+ 1
+ 1
+ 0
+
+
+ Debug
+ select
+ adminhtml/system_config_source_yesno
+ 10
+ 1
+ 1
+ 0
+
+
+ Payment from applicable countries
+ allowspecific
+ 50
+ adminhtml/system_config_source_payment_allspecificcountries
+ 1
+ 1
+ 0
+
+
+ Payment from Specific countries
+ multiselect
+ 51
+ adminhtml/system_config_source_country
+ 1
+ 1
+ 0
+
+
+ Sort order
+ text
+ 100
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/core/Mage/Protx/sql/protx_setup/mysql4-install-0.1.0.php b/app/code/core/Mage/Protx/sql/protx_setup/mysql4-install-0.1.0.php
new file mode 100644
index 0000000000..b8d74b89c6
--- /dev/null
+++ b/app/code/core/Mage/Protx/sql/protx_setup/mysql4-install-0.1.0.php
@@ -0,0 +1,46 @@
+startSetup();
+
+$installer->run("
+CREATE TABLE `{$this->getTable('protx_api_debug')}` (
+ `debug_id` int(10) unsigned NOT NULL auto_increment,
+ `transaction_id` varchar(255) NOT NULL default '',
+ `debug_at` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `request_body` text,
+ `response_body` text,
+ PRIMARY KEY (`debug_id`),
+ KEY `debug_at` (`debug_at`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+ ");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Reports/Block/Product/Abstract.php b/app/code/core/Mage/Reports/Block/Product/Abstract.php
index 2ab0387f3e..561f956bf8 100644
--- a/app/code/core/Mage/Reports/Block/Product/Abstract.php
+++ b/app/code/core/Mage/Reports/Block/Product/Abstract.php
@@ -20,20 +20,47 @@
*
* @category Mage
* @package Mage_Reports
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+
+/**
+ * Reports Recently Products Abstract Block
+ *
+ * @category Mage
+ * @package Mage_Reports
+ * @author Magento Core Team
+ */
abstract class Mage_Reports_Block_Product_Abstract extends Mage_Catalog_Block_Product_Abstract
{
- protected $_eventTypeId = 0;
+ /**
+ * Product Index model name
+ *
+ * @var string
+ */
+ protected $_indexName;
+
+ /**
+ * Product Index model instance
+ *
+ * @var Mage_Reports_Model_Product_Index_Abstract
+ */
+ protected $_indexModel;
+
+ /**
+ * Product Index Collection
+ *
+ * @var Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
+ */
+ protected $_collection;
/**
- * Retrieve page size (count)
+ * Retrieve page size
*
* @return int
*/
- protected function getPageSize()
+ public function getPageSize()
{
if ($this->hasData('page_size')) {
return $this->getData('page_size');
@@ -42,7 +69,8 @@ protected function getPageSize()
}
/**
- * Obtain product ids, that must not be included in collection
+ * Retrieve product ids, that must not be included in collection
+ *
* @return array
*/
protected function _getProductsToSkip()
@@ -51,36 +79,68 @@ protected function _getProductsToSkip()
}
/**
- * Get products collection and apply recent events log to it
+ * Retrieve Product Index model instance
*
- * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
+ * @return Mage_Reports_Model_Product_Index_Abstract
*/
- protected function _getRecentProductsCollection()
+ protected function _getModel()
{
- // get products collection and apply status and visibility filter
- $collection = $this->_addProductAttributesAndPrices(Mage::getModel('catalog/product')->getCollection())
- ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
- ->addUrlRewrite()
- ->setPageSize($this->getPageSize())
- ->setCurPage(1)
- ;
- Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
- Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
+ if (is_null($this->_indexModel)) {
+ if (is_null($this->_indexName)) {
+ Mage::throwException(Mage::helper('reports')->__('Index model name must be defined'));
+ }
- // apply events log to collection with required parameters
- $skip = $this->_getProductsToSkip();
- $subtype = 0;
- if (Mage::getSingleton('customer/session')->isLoggedIn()) {
- $subjectId = Mage::getSingleton('customer/session')->getCustomer()->getId();
- } else {
- $subjectId = Mage::getSingleton('log/visitor')->getId();
- $subtype = 1;
+ $this->_indexModel = Mage::getModel($this->_indexName);
}
- Mage::getResourceSingleton('reports/event')->applyLogToCollection($collection, $this->_eventTypeId, $subjectId, $subtype, $skip);
- foreach ($collection as $product) {
- $product->setDoNotUseCategoryId(true);
+ return $this->_indexModel;
+ }
+
+ /**
+ * Retrieve Index Product Collection
+ *
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
+ */
+ public function getItemsCollection()
+ {
+ if (is_null($this->_collection)) {
+ $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
+
+ $this->_collection = $this->_getModel()
+ ->getCollection()
+ ->addAttributeToSelect($attributes)
+ ->addIndexFilter()
+ ->excludeProductIds($this->_getModel()->getExcludeProductIds())
+ ->setAddedAtOrder();
+
+ Mage::getSingleton('catalog/product_visibility')
+ ->addVisibleInSiteFilterToCollection($this->_collection);
}
- return $collection;
+
+ return $this->_collection;
+ }
+
+ /**
+ * Retrieve count of product index items
+ *
+ * @return int
+ */
+ public function getCount()
+ {
+ if (!$this->_getModel()->getCount()) {
+ return 0;
+ }
+ return $this->getItemsCollection()->count();
+ }
+
+ /**
+ * Get products collection and apply recent events log to it
+ *
+ * @deprecated
+ * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
+ */
+ protected function _getRecentProductsCollection()
+ {
+ return $this->getItemsCollection();
}
}
diff --git a/app/code/core/Mage/Reports/Block/Product/Compared.php b/app/code/core/Mage/Reports/Block/Product/Compared.php
index 0f9f0458c2..08e9d1d8eb 100644
--- a/app/code/core/Mage/Reports/Block/Product/Compared.php
+++ b/app/code/core/Mage/Reports/Block/Product/Compared.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Reports
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -29,21 +29,25 @@
*
* @category Mage
* @package Mage_Reports
- * @author Magento Core Team
+ * @author Magento Core Team
*/
-
class Mage_Reports_Block_Product_Compared extends Mage_Reports_Block_Product_Abstract
{
const XML_PATH_RECENTLY_COMPARED_COUNT = 'catalog/recently_products/compared_count';
- protected $_eventTypeId = Mage_Reports_Model_Event::EVENT_PRODUCT_COMPARE;
+ /**
+ * Compared Product Index model name
+ *
+ * @var string
+ */
+ protected $_indexName = 'reports/product_index_compared';
/**
* Retrieve page size (count)
*
* @return int
*/
- protected function getPageSize()
+ public function getPageSize()
{
if ($this->hasData('page_size')) {
return $this->getData('page_size');
@@ -51,55 +55,19 @@ protected function getPageSize()
return Mage::getStoreConfig(self::XML_PATH_RECENTLY_COMPARED_COUNT);
}
- /**
- * Retrieve Product Ids to skip
- *
- * @return array
- */
- protected function _getProductsToSkip()
- {
- $ids = array();
- if (Mage::helper('catalog/product_compare')->getItemCount()) {
- foreach (Mage::helper('catalog/product_compare')->getItemCollection() as $_item) {
- $ids[] = $_item->getId();
- }
- if (($product = Mage::registry('product')) && $product->getId()) {
- $ids[] = $product->getId();
- }
- }
- return $ids;
- }
-
- /**
- * Check session has compared products
- *
- * @return bool
- */
- protected function _hasComparedProductsBefore()
- {
- return Mage::getSingleton('reports/session')->getData('compared_products');
- }
-
/**
* Prepare to html
- * check has compared products
+ * Check has compared products
*
* @return string
*/
protected function _toHtml()
{
- if (!$this->_hasComparedProductsBefore()) {
+ if (!$this->getCount()) {
return '';
}
- $collection = $this->_getRecentProductsCollection();
- $hasProducts = (bool)count($collection);
- if (is_null($this->_hasComparedProductsBefore())) {
- Mage::getSingleton('reports/session')->setData('compared_products', $hasProducts);
- }
- if ($hasProducts) {
- $this->setRecentlyComparedProducts($collection);
- }
+ $this->setRecentlyComparedProducts($this->getItemsCollection());
return parent::_toHtml();
}
diff --git a/app/code/core/Mage/Reports/Block/Product/Viewed.php b/app/code/core/Mage/Reports/Block/Product/Viewed.php
index e66a09a748..12fdb99946 100644
--- a/app/code/core/Mage/Reports/Block/Product/Viewed.php
+++ b/app/code/core/Mage/Reports/Block/Product/Viewed.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Reports
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -29,21 +29,25 @@
*
* @category Mage
* @package Mage_Reports
- * @author Magento Core Team
+ * @author Magento Core Team
*/
-
class Mage_Reports_Block_Product_Viewed extends Mage_Reports_Block_Product_Abstract
{
const XML_PATH_RECENTLY_VIEWED_COUNT = 'catalog/recently_products/viewed_count';
- protected $_eventTypeId = Mage_Reports_Model_Event::EVENT_PRODUCT_VIEW;
+ /**
+ * Viewed Product Index model name
+ *
+ * @var string
+ */
+ protected $_indexName = 'reports/product_index_viewed';
/**
* Retrieve page size (count)
*
* @return int
*/
- protected function getPageSize()
+ public function getPageSize()
{
if ($this->hasData('page_size')) {
return $this->getData('page_size');
@@ -51,30 +55,6 @@ protected function getPageSize()
return Mage::getStoreConfig(self::XML_PATH_RECENTLY_VIEWED_COUNT);
}
- /**
- * Retrieve Product Ids to skip
- *
- * @return array
- */
- protected function _getProductsToSkip()
- {
- $ids = array();
- if (($product = Mage::registry('product')) && $product->getId()) {
- $ids = (int)$product->getId();
- }
- return $ids;
- }
-
- /**
- * Check session has viewed products
- *
- * @return bool
- */
- protected function _hasViewedProductsBefore()
- {
- return Mage::getSingleton('reports/session')->getData('viewed_products');
- }
-
/**
* Prepare to html
* check has viewed products
@@ -83,18 +63,11 @@ protected function _hasViewedProductsBefore()
*/
protected function _toHtml()
{
- if (!$this->_hasViewedProductsBefore()) {
+ if (!$this->getCount()) {
return '';
}
- $collection = $this->_getRecentProductsCollection();
- $hasProducts = (bool)count($collection);
- if (is_null($this->_hasViewedProductsBefore())) {
- Mage::getSingleton('reports/session')->setData('viewed_products', $hasProducts);
- }
- if ($hasProducts) {
- $this->setRecentlyViewedProducts($collection);
- }
+ $this->setRecentlyViewedProducts($this->getItemsCollection());
return parent::_toHtml();
}
diff --git a/app/code/core/Mage/Reports/Helper/Data.php b/app/code/core/Mage/Reports/Helper/Data.php
index fd2d63d9d8..89fd2da7d2 100644
--- a/app/code/core/Mage/Reports/Helper/Data.php
+++ b/app/code/core/Mage/Reports/Helper/Data.php
@@ -29,5 +29,4 @@
*/
class Mage_Reports_Helper_Data extends Mage_Core_Helper_Abstract
{
-
}
diff --git a/app/code/core/Mage/Reports/Model/Event/Observer.php b/app/code/core/Mage/Reports/Model/Event/Observer.php
index e4f1546b2a..5d8cf75698 100644
--- a/app/code/core/Mage/Reports/Model/Event/Observer.php
+++ b/app/code/core/Mage/Reports/Model/Event/Observer.php
@@ -20,20 +20,31 @@
*
* @category Mage
* @package Mage_Reports
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+
/**
- * Report event observer model
+ * Reports Event observer model
*
* @category Mage
* @package Mage_Reports
- * @author Magento Core Team
+ * @author Magento Core Team
*/
-
class Mage_Reports_Model_Event_Observer
{
+ /**
+ * Abstract Event obeserver logic
+ *
+ * Save event
+ *
+ * @param int $eventTypeId
+ * @param int $objectId
+ * @param int $subjectId
+ * @param int $subtype
+ * @return Mage_Reports_Model_Event_Observer
+ */
protected function _event($eventTypeId, $objectId, $subjectId = null, $subtype = 0)
{
if (is_null($subjectId)) {
@@ -60,48 +71,137 @@ protected function _event($eventTypeId, $objectId, $subjectId = null, $subtype =
return $this;
}
- public function customerLogin(Varien_Event_Observer $observer) {
+ /**
+ * Customer login action
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
+ public function customerLogin(Varien_Event_Observer $observer)
+ {
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
return $this;
}
- $customer = Mage::getSingleton('customer/session')->getCustomer();
- $visitorId = Mage::getSingleton('log/visitor')->getId();
- $customerId = $customer->getId();
+
+ $visitorId = Mage::getSingleton('log/visitor')->getId();
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
$eventModel = Mage::getModel('reports/event');
$eventModel->updateCustomerType($visitorId, $customerId);
+
+ Mage::getModel('reports/product_index_compared')
+ ->updateCustomerFromVisitor()
+ ->calculate();
+ Mage::getModel('reports/product_index_viewed')
+ ->updateCustomerFromVisitor()
+ ->calculate();
+
+ return $this;
+ }
+
+ /**
+ * Customer logout processing
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
+ public function customerLogout(Varien_Event_Observer $observer)
+ {
+ Mage::getModel('reports/product_index_compared')
+ ->purgeVisitorByCustomer()
+ ->calculate();
+ Mage::getModel('reports/product_index_viewed')
+ ->purgeVisitorByCustomer()
+ ->calculate();
+ return $this;
}
+ /**
+ * View Catalog Product action
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
public function catalogProductView(Varien_Event_Observer $observer)
{
- Mage::getSingleton('reports/session')->setData('viewed_products', true);
- return $this->_event(
- Mage_Reports_Model_Event::EVENT_PRODUCT_VIEW,
- $observer->getEvent()->getProduct()->getId()
- );
+ $productId = $observer->getEvent()->getProduct()->getId();
+
+ Mage::getModel('reports/product_index_viewed')
+ ->setProductId($productId)
+ ->save()
+ ->calculate();
+
+ return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_VIEW, $productId);
}
+ /**
+ * Send Product link to friends action
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
public function sendfriendProduct(Varien_Event_Observer $observer)
{
- return $this->_event(
- Mage_Reports_Model_Event::EVENT_PRODUCT_SEND,
+ return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_SEND,
$observer->getEvent()->getProduct()->getId()
);
}
+ /**
+ * Remove Product from Compare Products action
+ *
+ * Reset count of compared products cache
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
public function catalogProductCompareRemoveProduct(Varien_Event_Observer $observer)
{
- Mage::getSingleton('reports/session')->setData('compared_products', null);
+ Mage::getModel('reports/product_index_compared')->calculate();
+
+ return $this;
+ }
+
+ /**
+ * Remove All Products from Compare Products
+ *
+ * Reset count of compared products cache
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
+ public function catalogProductCompareClear(Varien_Event_Observer $observer)
+ {
+ Mage::getModel('reports/product_index_compared')->calculate();
+
+ return $this;
}
+ /**
+ * Add Product to Compare Products List action
+ *
+ * Reset count of compared products cache
+ *
+ * @param Varien_Event_Observer $observer
+ * @return unknown
+ */
public function catalogProductCompareAddProduct(Varien_Event_Observer $observer)
{
- Mage::getSingleton('reports/session')->setData('compared_products', true);
- return $this->_event(
- Mage_Reports_Model_Event::EVENT_PRODUCT_COMPARE,
- $observer->getEvent()->getProduct()->getId()
- );
+ $productId = $observer->getEvent()->getProduct()->getId();
+
+ Mage::getModel('reports/product_index_compared')
+ ->setProductId($productId)
+ ->save()
+ ->calculate();
+
+ return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_COMPARE, $productId);
}
+ /**
+ * Add product to shopping cart action
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
public function checkoutCartAddProduct(Varien_Event_Observer $observer)
{
$quoteItem = $observer->getEvent()->getItem();
@@ -112,34 +212,49 @@ public function checkoutCartAddProduct(Varien_Event_Observer $observer)
return $this;
}
+ /**
+ * Add product to wishlist action
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
public function wishlistAddProduct(Varien_Event_Observer $observer)
{
- return $this->_event(
- Mage_Reports_Model_Event::EVENT_PRODUCT_TO_WISHLIST,
+ return $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_TO_WISHLIST,
$observer->getEvent()->getProduct()->getId()
);
}
+ /**
+ * Share customer wishlist action
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Reports_Model_Event_Observer
+ */
public function wishlistShare(Varien_Event_Observer $observer)
{
- return $this->_event(
- Mage_Reports_Model_Event::EVENT_WISHLIST_SHARE,
+ return $this->_event(Mage_Reports_Model_Event::EVENT_WISHLIST_SHARE,
$observer->getEvent()->getWishlist()->getId()
);
}
/**
- * event clean
+ * Clean events by old visitors
+ *
+ * @see Global Log Clean Settings
*
* @param Varien_Event_Observer $observer
* @return Mage_Reports_Model_Event_Observer
*/
public function eventClean(Varien_Event_Observer $observer)
{
- $event = Mage::getModel('reports/event');
/* @var $event Mage_Reports_Model_Event */
+ $event = Mage::getModel('reports/event');
$event->clean();
+ Mage::getModel('reports/product_index_compared')->clean();
+ Mage::getModel('reports/product_index_viewed')->clean();
+
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Order/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Order/Collection.php
index 2114fa4824..33e2249895 100644
--- a/app/code/core/Mage/Reports/Model/Mysql4/Order/Collection.php
+++ b/app/code/core/Mage/Reports/Model/Mysql4/Order/Collection.php
@@ -114,7 +114,7 @@ public function getDateRange($range, $customStart, $customEnd, $returnObjects =
break;
case '1m':
- $dateStart->setDay(1);
+ $dateStart->setDay(Mage::getStoreConfig('reports/dashboard/mtd_start'));
break;
case 'custom':
@@ -123,13 +123,15 @@ public function getDateRange($range, $customStart, $customEnd, $returnObjects =
break;
case '1y':
- $dateStart->setMonth(1);
- $dateStart->setDay(1);
- break;
case '2y':
- $dateStart->setMonth(1);
- $dateStart->setDay(1);
- $dateStart->subYear(1);
+ $startMonthDay = explode(',', Mage::getStoreConfig('reports/dashboard/ytd_start'));
+ $startMonth = isset($startMonthDay[0]) ? (int)$startMonthDay[0] : 1;
+ $startDay = isset($startMonthDay[1]) ? (int)$startMonthDay[1] : 1;
+ $dateStart->setMonth($startMonth);
+ $dateStart->setDay($startDay);
+ if ($range == '2y') {
+ $dateStart->subYear(1);
+ }
break;
}
diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Abstract.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Abstract.php
new file mode 100644
index 0000000000..3936b91f41
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Abstract.php
@@ -0,0 +1,155 @@
+
+ */
+abstract class Mage_Reports_Model_Mysql4_Product_Index_Abstract extends Mage_Core_Model_Mysql4_Abstract
+{
+ /**
+ * Fields List for update in forsedSave
+ *
+ * @var array
+ */
+ protected $_fieldsForUpdate = array('store_id', 'added_at');
+
+ /**
+ * Update Customer from visitor (Customer loggin)
+ *
+ * @param Mage_Reports_Model_Product_Index_Abstract $object
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Abstract
+ */
+ public function updateCustomerFromVisitor(Mage_Reports_Model_Product_Index_Abstract $object)
+ {
+ /**
+ * Do nothing if customer not logged in
+ */
+ if (!$object->getCustomerId()) {
+ return $this;
+ }
+
+ $select = $this->_getWriteAdapter()->select()
+ ->from($this->getMainTable())
+ ->where('visitor_id=?', $object->getVisitorId());
+ $rowSet = $select->query()->fetchAll();
+ foreach ($rowSet as $row) {
+ $select = $this->_getWriteAdapter()->select()
+ ->from($this->getMainTable())
+ ->where('customer_id=?', $object->getCustomerId())
+ ->where('product_id=?', $row['product_id']);
+ $idx = $this->_getWriteAdapter()->fetchRow($select);
+
+ if ($idx) {
+ $this->_getWriteAdapter()->delete($this->getMainTable(),
+ $this->_getWriteAdapter()->quoteInto('index_id=?', $row['index_id'])
+ );
+ $this->_getWriteAdapter()->update($this->getMainTable(), array(
+ 'visitor_id' => $object->getVisitorId(),
+ 'store_id' => $object->getStoreId(),
+ 'added_at' => now(),
+ ), $this->_getWriteAdapter()->quoteInto('index_id=?', $idx['index_id']));
+ }
+ else {
+ $this->_getWriteAdapter()->update($this->getMainTable(), array(
+ 'customer_id' => $object->getCustomerId(),
+ 'store_id' => $object->getStoreId(),
+ 'added_at' => now()
+ ), $this->_getWriteAdapter()->quoteInto('index_id=?', $row['index_id']));
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Purge visitor data by customer (logout)
+ *
+ * @param Mage_Reports_Model_Product_Index_Abstract $object
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Abstract
+ */
+ public function purgeVisitorByCustomer(Mage_Reports_Model_Product_Index_Abstract $object)
+ {
+ if (!$object->getCustomerId()) {
+ return $this;
+ }
+
+ $where = $this->_getWriteAdapter()->quoteInto('customer_id=?', $object->getCustomerId());
+ $bind = array(
+ 'visitor_id' => 0,
+ );
+
+ $this->_getWriteAdapter()->update($this->getMainTable(), $bind, $where);
+
+ return $this;
+ }
+
+ /**
+ * Save Product Index data (forsed save)
+ *
+ * @param Mage_Reports_Model_Product_Index_Abstract $object
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Abstract
+ */
+ public function save(Mage_Core_Model_Abstract $object)
+ {
+ return $this->forsedSave($object);
+ }
+
+ /**
+ * Clean index (visitor)
+ *
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Abstract
+ */
+ public function clean()
+ {
+ while (true) {
+ $select = $this->_getReadAdapter()->select()
+ ->from(array('main_table' => $this->getMainTable()), array($this->getIdFieldName()))
+ ->joinLeft(
+ array('visitor_table' => $this->getTable('log/visitor')),
+ 'main_table.visitor_id = visitor_table.visitor_id',
+ array())
+ ->where('main_table.visitor_id > 0')
+ ->where('visitor_table.visitor_id IS NULL')
+ ->limit(100);
+ $indexIds = $this->_getReadAdapter()->fetchCol($select);
+
+ if (!$indexIds) {
+ break;
+ }
+
+ $this->_getWriteAdapter()->delete(
+ $this->getMainTable(),
+ $this->_getWriteAdapter()->quoteInto($this->getIdFieldName() . ' IN(?)', $indexIds)
+ );
+ }
+ return $this;
+ }
+}
diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Collection/Abstract.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Collection/Abstract.php
new file mode 100644
index 0000000000..e3d31e0ca8
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Collection/Abstract.php
@@ -0,0 +1,116 @@
+
+ */
+abstract class Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
+ extends Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
+{
+ /**
+ * Retrieve Product Index table name
+ *
+ * @return string
+ */
+ abstract protected function _getTableName();
+
+ /**
+ * Add Viewed Products Index to Collection
+ *
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
+ */
+ public function addIndexFilter()
+ {
+ $this->joinTable(
+ array('idx_table' => $this->_getTableName()),
+ 'product_id=entity_id',
+ array(
+ 'product_id' => 'product_id',
+ 'item_store_id' => 'store_id',
+ 'added_at' => 'added_at'
+ ),
+ $this->_getWhereCondition()
+ );
+
+ $this->_productLimitationFilters['store_table'] = 'idx_table';
+
+ $this->setFlag('url_data_object', true);
+ $this->setFlag('do_not_use_category_id', true);
+
+ return $this;
+ }
+
+ /**
+ * Retrieve Where Condition to Index table
+ *
+ * @return array
+ */
+ protected function _getWhereCondition()
+ {
+ $condition = array();
+
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
+ $condition['customer_id'] = Mage::getSingleton('customer/session')->getCustomerId();
+ }
+ else {
+ $condition['visitor_id'] = Mage::getSingleton('log/visitor')->getId();
+ }
+
+ return $condition;
+ }
+
+ /**
+ * Add order by "added at"
+ *
+ * @param string $dir
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
+ */
+ public function setAddedAtOrder($dir = 'desc')
+ {
+ $this->setOrder("added_at", $dir);
+ return $this;
+ }
+
+ /**
+ * Add exclude Product Ids
+ *
+ * @param int|array $productIds
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
+ */
+ public function excludeProductIds($productIds)
+ {
+ if (empty($productIds)) {
+ return $this;
+ }
+ $this->getSelect()->where('idx_table.product_id NOT IN(?)', $productIds);
+ return $this;
+ }
+}
diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared.php
new file mode 100644
index 0000000000..298ae0e9f5
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Reports_Model_Mysql4_Product_Index_Compared extends Mage_Reports_Model_Mysql4_Product_Index_Abstract
+{
+ /**
+ * Initialize connection and main resource table
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('reports/compared_product_index', 'index_id');
+ }
+}
diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared/Collection.php
new file mode 100644
index 0000000000..074d3d8dde
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Compared/Collection.php
@@ -0,0 +1,46 @@
+
+ */
+class Mage_Reports_Model_Mysql4_Product_Index_Compared_Collection extends Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
+{
+ /**
+ * Retrieve Product Index table name
+ *
+ * @return string
+ */
+ protected function _getTableName()
+ {
+ return $this->getTable('reports/compared_product_index');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed.php
new file mode 100644
index 0000000000..f5c8718627
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Reports_Model_Mysql4_Product_Index_Viewed extends Mage_Reports_Model_Mysql4_Product_Index_Abstract
+{
+ /**
+ * Initialize connection and main resource table
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('reports/viewed_product_index', 'index_id');
+ }
+}
diff --git a/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed/Collection.php b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed/Collection.php
new file mode 100644
index 0000000000..551aa92db7
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Mysql4/Product/Index/Viewed/Collection.php
@@ -0,0 +1,46 @@
+
+ */
+class Mage_Reports_Model_Mysql4_Product_Index_Viewed_Collection extends Mage_Reports_Model_Mysql4_Product_Index_Collection_Abstract
+{
+ /**
+ * Retrieve Product Index table name
+ *
+ * @return string
+ */
+ protected function _getTableName()
+ {
+ return $this->getTable('reports/viewed_product_index');
+ }
+}
diff --git a/app/code/core/Mage/Reports/Model/Product/Index/Abstract.php b/app/code/core/Mage/Reports/Model/Product/Index/Abstract.php
new file mode 100644
index 0000000000..1173a66cd4
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Product/Index/Abstract.php
@@ -0,0 +1,220 @@
+
+ */
+abstract class Mage_Reports_Model_Product_Index_Abstract extends Mage_Core_Model_Abstract
+{
+ /**
+ * Cache key name for Count of product index
+ *
+ * @var string
+ */
+ protected $_countCacheKey;
+
+ /**
+ * Prepare customer/visitor, store data before save
+ *
+ * @return Mage_Reports_Model_Product_Index_Abstract
+ */
+ protected function _beforeSave()
+ {
+ parent::_beforeSave();
+
+ if (!$this->hasVisitorId()) {
+ $this->setVisitorId($this->getVisitorId());
+ }
+ if (!$this->hasCustomerId()) {
+ $this->setCustomerId($this->getCustomerId());
+ }
+ if (!$this->hasStoreId()) {
+ $this->setStoreId($this->getStoreId());
+ }
+ if (!$this->hasAddedAt()) {
+ $this->setAddedAt(now());
+ }
+
+ return $this;
+ }
+
+ /**
+ * Retrieve visitor id
+ *
+ * if don't exists return current visitor id
+ *
+ * @return int
+ */
+ public function getVisitorId()
+ {
+ if ($this->hasData('visitor_id')) {
+ return $this->getData('visitor_id');
+ }
+ return Mage::getSingleton('log/visitor')->getId();
+ }
+
+ /**
+ * Retrieve customer id
+ *
+ * if customer don't logged in return null
+ *
+ * @return int
+ */
+ public function getCustomerId()
+ {
+ if ($this->hasData('customer_id')) {
+ return $this->getData('customer_id');
+ }
+ return Mage::getSingleton('customer/session')->getCustomerId();
+ }
+
+ /**
+ * Retrieve store id
+ *
+ * default return current store id
+ *
+ * @return int
+ */
+ public function getStoreId()
+ {
+ if ($this->hasData('store_id')) {
+ return $this->getData('store_id');
+ }
+ return Mage::app()->getStore()->getId();
+ }
+
+ /**
+ * Retrieve resource instance wrapper
+ *
+ * @return Mage_Reports_Model_Mysql4_Product_Index_Abstract
+ */
+ protected function _getResource()
+ {
+ return parent::_getResource();
+ }
+
+ /**
+ * On customer loggin merge visitor/customer index
+ *
+ * @return Mage_Reports_Model_Product_Index_Abstract
+ */
+ public function updateCustomerFromVisitor()
+ {
+ $this->_getResource()->updateCustomerFromVisitor($this);
+ return $this;
+ }
+
+ /**
+ * Purge visitor data by customer (logout)
+ *
+ * @return Mage_Reports_Model_Product_Index_Abstract
+ */
+ public function purgeVisitorByCustomer()
+ {
+ $this->_getResource()->purgeVisitorByCustomer($this);
+ return $this;
+ }
+
+ /**
+ * Retrieve Reports Session instance
+ *
+ * @return Mage_Reports_Model_Session
+ */
+ protected function _getSession()
+ {
+ return Mage::getSingleton('reports/session');
+ }
+
+ /**
+ * Calculate count of product index items cache
+ *
+ * @return Mage_Reports_Model_Product_Index_Abstract
+ */
+ public function calculate()
+ {
+ if (!$this->_getSession()->hasData($this->_countCacheKey)) {
+ $count = 0;
+ }
+ else {
+ $collection = $this->getCollection()
+ ->addIndexFilter()
+ ->excludeProductIds($this->getExcludeProductIds());
+
+ Mage::getSingleton('catalog/product_visibility')
+ ->addVisibleInSiteFilterToCollection($collection);
+
+ $count = $collection->getSize();
+ }
+
+ $this->_getSession()->setData($this->_countCacheKey, $count);
+
+ return $this;
+ }
+
+ /**
+ * Retrieve Exclude Product Ids List for Collection
+ *
+ * @return array
+ */
+ public function getExcludeProductIds()
+ {
+ return array();
+ }
+
+ /**
+ * Retrieve count of product index items
+ *
+ * @return int
+ */
+ public function getCount()
+ {
+ if (!$this->_countCacheKey) {
+ return 0;
+ }
+
+ if (!$this->_getSession()->hasData($this->_countCacheKey)) {
+ $this->calculate();
+ }
+
+ return $this->_getSession()->getData($this->_countCacheKey);
+ }
+
+ /**
+ * Clean index (visitors)
+ *
+ * @return Mage_Reports_Model_Product_Index_Abstract
+ */
+ public function clean()
+ {
+ $this->_getResource()->clean($this);
+ return $this;
+ }
+}
diff --git a/app/code/core/Mage/Reports/Model/Product/Index/Compared.php b/app/code/core/Mage/Reports/Model/Product/Index/Compared.php
new file mode 100644
index 0000000000..562d94c3ee
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Product/Index/Compared.php
@@ -0,0 +1,77 @@
+
+ */
+class Mage_Reports_Model_Product_Index_Compared extends Mage_Reports_Model_Product_Index_Abstract
+{
+ /**
+ * Cache key name for Count of product index
+ *
+ * @var string
+ */
+ protected $_countCacheKey = 'product_index_compared_count';
+
+ /**
+ * Initialize resource model
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('reports/product_index_compared');
+ }
+
+ /**
+ * Retrieve Exclude Product Ids List for Collection
+ *
+ * @return array
+ */
+ public function getExcludeProductIds()
+ {
+ $productIds = array();
+
+ /* @var $helper Mage_Catalog_Helper_Product_Compare */
+ $helper = Mage::helper('catalog/product_compare');
+
+ if ($helper->hasItems()) {
+ foreach ($helper->getItemCollection() as $_item) {
+ $productIds[] = $_item->getEntityId();
+ }
+ }
+
+ if (Mage::registry('current_product')) {
+ $productIds[] = Mage::registry('current_product')->getId();
+ }
+
+ return array_unique($productIds);
+ }
+}
diff --git a/app/code/core/Mage/Reports/Model/Product/Index/Viewed.php b/app/code/core/Mage/Reports/Model/Product/Index/Viewed.php
new file mode 100644
index 0000000000..69e4226bd0
--- /dev/null
+++ b/app/code/core/Mage/Reports/Model/Product/Index/Viewed.php
@@ -0,0 +1,68 @@
+
+ */
+class Mage_Reports_Model_Product_Index_Viewed extends Mage_Reports_Model_Product_Index_Abstract
+{
+ /**
+ * Cache key name for Count of product index
+ *
+ * @var string
+ */
+ protected $_countCacheKey = 'product_index_compared_count';
+
+ /**
+ * Initialize resource model
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('reports/product_index_viewed');
+ }
+
+ /**
+ * Retrieve Exclude Product Ids List for Collection
+ *
+ * @return array
+ */
+ public function getExcludeProductIds()
+ {
+ $productIds = array();
+
+ if (Mage::registry('current_product')) {
+ $productIds[] = Mage::registry('current_product')->getId();
+ }
+
+ return $productIds;
+ }
+}
diff --git a/app/code/core/Mage/Reports/Model/Session.php b/app/code/core/Mage/Reports/Model/Session.php
index c4d7ce2d12..eef34c9e15 100644
--- a/app/code/core/Mage/Reports/Model/Session.php
+++ b/app/code/core/Mage/Reports/Model/Session.php
@@ -1,41 +1,45 @@
-
- */
-class Mage_Reports_Model_Session extends Mage_Core_Model_Session_Abstract
-{
- public function __construct()
- {
- $this->init('reports');
- }
-}
\ No newline at end of file
+
+ */
+class Mage_Reports_Model_Session extends Mage_Core_Model_Session_Abstract
+{
+ /**
+ * Initialize session name space
+ *
+ */
+ public function __construct()
+ {
+ $this->init('reports');
+ }
+}
diff --git a/app/code/core/Mage/Reports/etc/config.xml b/app/code/core/Mage/Reports/etc/config.xml
index 8315d4f153..2a0aae3760 100644
--- a/app/code/core/Mage/Reports/etc/config.xml
+++ b/app/code/core/Mage/Reports/etc/config.xml
@@ -28,7 +28,7 @@
- 0.7.7
+ 0.7.8
@@ -46,6 +46,12 @@
+
+ report_compared_product_index
+
+
+ report_viewed_product_index
+
@@ -70,80 +76,7 @@
-
-
-
-
- singleton
- reports/event_observer
- catalogProductCompareRemoveProduct
-
-
-
-
-
-
- singleton
- reports/event_observer
- customerLogin
-
-
-
-
-
-
- singleton
- reports/event_observer
- catalogProductView
-
-
-
-
-
-
- singleton
- reports/event_observer
- sendfriendProduct
-
-
-
-
-
-
- singleton
- reports/event_observer
- catalogProductCompareAddProduct
-
-
-
-
-
-
- singleton
- reports/event_observer
- checkoutCartAddProduct
-
-
-
-
-
-
- singleton
- reports/event_observer
- wishlistAddProduct
-
-
-
-
-
-
- singleton
- reports/event_observer
- wishlistShare
-
-
-
@@ -423,6 +356,17 @@
+
+
+
+
+
+ Reports
+
+
+
+
+
@@ -445,9 +389,101 @@
+
+
+
+
+ singleton
+ reports/event_observer
+ catalogProductCompareRemoveProduct
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ customerLogin
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ customerLogout
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ catalogProductView
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ sendfriendProduct
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ catalogProductCompareAddProduct
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ catalogProductCompareClear
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ checkoutCartAddProduct
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ wishlistAddProduct
+
+
+
+
+
+
+ singleton
+ reports/event_observer
+ wishlistShare
+
+
+
+
-
+
website
@@ -455,5 +491,11 @@
5
+
+
+ 1,1
+ 1
+
+
diff --git a/app/code/core/Mage/Reports/etc/system.xml b/app/code/core/Mage/Reports/etc/system.xml
index 82bbb915ff..0b0b1838da 100644
--- a/app/code/core/Mage/Reports/etc/system.xml
+++ b/app/code/core/Mage/Reports/etc/system.xml
@@ -66,5 +66,45 @@
+
+ Reports
+ general
+ text
+ 1000
+ 1
+ 0
+ 0
+
+
+ Dashboard
+ text
+ 1
+ 1
+ 0
+ 0
+
+
+ Year-To-Date Starts
+ select
+ adminhtml/report_config_form_field_ytdStart
+ 1
+ 1
+ 0
+ 0
+
+
+ Month-To-Date Starts
+ select
+ adminhtml/report_config_form_field_mtdStart
+ Select day of the month
+ 2
+ 1
+ 0
+ 0
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.7-0.7.8.php
new file mode 100644
index 0000000000..5845ee48ac
--- /dev/null
+++ b/app/code/core/Mage/Reports/sql/reports_setup/mysql4-upgrade-0.7.7-0.7.8.php
@@ -0,0 +1,71 @@
+startSetup();
+$installer->run("
+
+CREATE TABLE `{$installer->getTable('reports/viewed_product_index')}` (
+ `index_id` bigint(20) unsigned NOT NULL auto_increment,
+ `visitor_id` int(10) unsigned NOT NULL,
+ `customer_id` int(10) unsigned default NULL,
+ `product_id` int(10) unsigned NOT NULL,
+ `store_id` smallint(5) unsigned default NULL,
+ `added_at` datetime NOT NULL,
+ PRIMARY KEY (`index_id`),
+ UNIQUE KEY `UNQ_BY_VISITOR` (`visitor_id`,`product_id`),
+ UNIQUE KEY `UNQ_BY_CUSTOMER` (`customer_id`,`product_id`),
+ KEY `IDX_STORE` (`store_id`),
+ KEY `IDX_SORT_ADDED_AT` (`added_at`),
+ KEY `product_id` (`product_id`),
+ CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$installer->getTable('core/store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER` FOREIGN KEY (`customer_id`) REFERENCES `{$installer->getTable('customer/entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog/product')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `{$installer->getTable('reports/compared_product_index')}` (
+ `index_id` bigint(20) unsigned NOT NULL auto_increment,
+ `visitor_id` int(10) unsigned NOT NULL,
+ `customer_id` int(10) unsigned default NULL,
+ `product_id` int(10) unsigned NOT NULL,
+ `store_id` smallint(5) unsigned default NULL,
+ `added_at` datetime NOT NULL,
+ PRIMARY KEY (`index_id`),
+ UNIQUE KEY `UNQ_BY_VISITOR` (`visitor_id`,`product_id`),
+ UNIQUE KEY `UNQ_BY_CUSTOMER` (`customer_id`,`product_id`),
+ KEY `IDX_STORE` (`store_id`),
+ KEY `IDX_SORT_ADDED_AT` (`added_at`),
+ KEY `product_id` (`product_id`),
+ CONSTRAINT `FK_REPORT_COMPARED_PRODUCT_INDEX_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$installer->getTable('core/store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE,
+ CONSTRAINT `FK_REPORT_COMPARED_PRODUCT_INDEX_CUSTOMER` FOREIGN KEY (`customer_id`) REFERENCES `{$installer->getTable('customer/entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `FK_REPORT_COMPARED_PRODUCT_INDEX_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog/product')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+");
+$installer->endSetup();
diff --git a/app/code/core/Mage/Review/controllers/ProductController.php b/app/code/core/Mage/Review/controllers/ProductController.php
index 138cb4ea88..87dd9231fb 100644
--- a/app/code/core/Mage/Review/controllers/ProductController.php
+++ b/app/code/core/Mage/Review/controllers/ProductController.php
@@ -68,7 +68,7 @@ public function preDispatch()
*
* @return Mage_Catalog_Model_Product
*/
- protected function _initProduct()
+ protected function _initProduct()
{
Mage::dispatchEvent('review_controller_product_init_before', array('controller_action'=>$this));
$categoryId = (int) $this->getRequest()->getParam('category', false);
@@ -195,6 +195,7 @@ public function viewAction()
{
$this->loadLayout();
$this->_initLayoutMessages('review/session');
+ $this->_initLayoutMessages('catalog/session');
$this->renderLayout();
}
diff --git a/app/code/core/Mage/Rss/Block/Catalog/New.php b/app/code/core/Mage/Rss/Block/Catalog/New.php
index daeb2aa628..422922b384 100644
--- a/app/code/core/Mage/Rss/Block/Catalog/New.php
+++ b/app/code/core/Mage/Rss/Block/Catalog/New.php
@@ -93,6 +93,15 @@ protected function _toHtml()
public function addNewItemXmlCallback($args)
{
$product = $args['product'];
+
+ $product->setAllowedInRss(true);
+ Mage::dispatchEvent('rss_catalog_new_xml_callback', $args);
+
+ if (!$product->getAllowedInRss()) {
+ //Skip adding product to RSS
+ return;
+ }
+
//$product->unsetData()->load($args['row']['entity_id']);
$product->setData($args['row']);
$final_price = $product->getFinalPrice();
diff --git a/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php b/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php
index 04f77bbeb3..9676c28d5a 100644
--- a/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php
+++ b/app/code/core/Mage/Rss/Block/Catalog/NotifyStock.php
@@ -58,7 +58,7 @@ protected function _toHtml()
$_configManageStock = (int)Mage::getStoreConfigFlag(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK);
$stockItemWhere = "({{table}}.low_stock_date is not null) "
. " and ({{table}}.low_stock_date>'0000-00-00') "
- . " and IF({{table}}.use_config_manage_stock=1," . $_configManageStock . ",{{table}}.manage_stock)=1";
+ . " and IF({{table}}.use_config_manage_stock=1," . $_configManageStock . ",{{table}}.manage_stock) <= 1";
$product = Mage::getModel('catalog/product');
$collection = $product->getCollection()
diff --git a/app/code/core/Mage/Rss/Block/Catalog/Special.php b/app/code/core/Mage/Rss/Block/Catalog/Special.php
index a02a1c9ab5..6fa5c48191 100644
--- a/app/code/core/Mage/Rss/Block/Catalog/Special.php
+++ b/app/code/core/Mage/Rss/Block/Catalog/Special.php
@@ -141,6 +141,21 @@ protected function _toHtml()
public function addSpecialXmlCallback($args)
{
+ /*
+ * RSS state object
+ */
+ $product = new Varien_Object();
+ //Product is allowed for RSS initially
+ $product->setAllowedInRss(true);
+ $args['product'] = $product;
+
+ Mage::dispatchEvent('rss_catalog_special_xml_callback', $args);
+
+ if (!$product->getAllowedInRss()) {
+ //Skip adding product to RSS
+ return;
+ }
+
//echo "";
//print_r($args['row']);
$row = $args['row'];
diff --git a/app/code/core/Mage/Rss/Block/Catalog/Tag.php b/app/code/core/Mage/Rss/Block/Catalog/Tag.php
index ed1b4a51b2..1bf0b34726 100644
--- a/app/code/core/Mage/Rss/Block/Catalog/Tag.php
+++ b/app/code/core/Mage/Rss/Block/Catalog/Tag.php
@@ -75,6 +75,15 @@ protected function _toHtml()
public function addTaggedItemXml($args)
{
$product = $args['product'];
+
+ $product->setAllowedInRss(true);
+ Mage::dispatchEvent('rss_catalog_tagged_item_xml_callback', $args);
+
+ if (!$product->getAllowedInRss()) {
+ //Skip adding product to RSS
+ return;
+ }
+
$product->unsetData()->load($args['row']['entity_id']);
$description = ' '.
' '.
diff --git a/app/code/core/Mage/Rss/Block/Wishlist.php b/app/code/core/Mage/Rss/Block/Wishlist.php
index f5db3797dd..86bc51018c 100644
--- a/app/code/core/Mage/Rss/Block/Wishlist.php
+++ b/app/code/core/Mage/Rss/Block/Wishlist.php
@@ -20,85 +20,142 @@
*
* @category Mage
* @package Mage_Rss
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
- * Review form block
+ * Customer Shared Wishlist Rss Block
*
* @category Mage
* @package Mage_Rss
- * @author Magento Core Team
+ * @author Magento Core Team
*/
-class Mage_Rss_Block_Wishlist extends Mage_Core_Block_Template
+class Mage_Rss_Block_Wishlist extends Mage_Wishlist_Block_Abstract
{
- protected function _toHtml()
+ /**
+ * Customer instance
+ *
+ * @var Mage_Customer_Model_Customer
+ */
+ protected $_customer;
+
+ /**
+ * Retrieve Wishlist model
+ *
+ * @return Mage_Wishlist_Model_Wishlist
+ */
+ protected function _getWishlist()
{
- $descrpt = Mage::helper('core')->urlDecode($this->getRequest()->getParam('data'));
- $data = explode(',',$descrpt);
- $cid = (int)$data[0];
+ if (is_null($this->_wishlist)) {
+ $this->_wishlist = Mage::getModel('wishlist/wishlist');
+ if ($this->_getCustomer()->getId()) {
+ $this->_wishlist->loadByCustomer($this->_getCustomer());
+ }
+ }
+ return $this->_wishlist;
+ }
- $rssObj = Mage::getModel('rss/rss');
+ /**
+ * Retrieve Customer instance
+ *
+ * @return Mage_Customer_Model_Customer
+ */
+ protected function _getCustomer()
+ {
+ if (is_null($this->_customer)) {
+ $this->_customer = Mage::getModel('customer/customer');
- if ($cid) {
- $customer = Mage::getModel('customer/customer')->load($cid);
- if ($customer && $customer->getId()) {
+ $params = Mage::helper('core')->urlDecode($this->getRequest()->getParam('data'));
+ $data = explode(',', $params);
+ $cId = abs(intval($data[0]));
+ if ($cId) {
+ $this->_customer->load($cId);
+ }
+ }
+
+ return $this->_customer;
+ }
- $wishlist = Mage::getModel('wishlist/wishlist')
- ->loadByCustomer($customer, true);
+ /**
+ * Render block HTML
+ *
+ * @return string
+ */
+ protected function _toHtml()
+ {
+ /* @var $rssObj Mage_Rss_Model_Rss */
+ $rssObj = Mage::getModel('rss/rss');
- $newurl = Mage::getUrl('wishlist/shared/index',array('code'=>$wishlist->getSharingCode()));
- $title = Mage::helper('rss')->__('%s\'s Wishlist',$customer->getName());
- $lang = Mage::getStoreConfig('general/locale/code');
+ if ($this->_getWishlist()->getId()) {
+ $newUrl = Mage::getUrl('wishlist/shared/index', array(
+ 'code' => $this->_getWishlist()->getSharingCode()
+ ));
- $data = array('title' => $title,
- 'description' => $title,
- 'link' => $newurl,
- 'charset' => 'UTF-8',
- 'language' => $lang
- );
- $rssObj->_addHeader($data);
+ $title = Mage::helper('rss')->__('%s\'s Wishlist', $this->_getCustomer()->getName());
+ $lang = Mage::getStoreConfig('general/locale/code');
- $collection = $wishlist->getProductCollection()
- ->addAttributeToSelect('url_key')
- ->addAttributeToSelect('name')
- ->addAttributeToSelect('price')
- ->addAttributeToSelect('thumbnail')
- ->addAttributeToFilter('store_id', array('in'=> $wishlist->getSharedStoreIds()))
- ->load();
+ $rssObj->_addHeader(array(
+ 'title' => $title,
+ 'description' => $title,
+ 'link' => $newUrl,
+ 'charset' => 'UTF-8',
+ 'language' => $lang
+ ));
- $product = Mage::getModel('catalog/product');
- foreach($collection as $item){
- $product->unsetData()->load($item->getProductId());
- $description = ''.
- ' '.
- ''.
- $product->getDescription().
- ' Price:'.Mage::helper('core')->currency($product->getPrice()).
- ($product->getPrice() != $product->getFinalPrice() ? ' Special Price:'. Mage::helper('core')->currency($product->getFinalPrice()) : '').
- ($item->getDescription() && $item->getDescription() != Mage::helper('wishlist')->defaultCommentString() ? '
Comment: '.$item->getDescription().'
' : '').
- '
'.
- '
';
- $data = array(
- 'title' => $product->getName(),
- 'link' => $product->getProductUrl(),
- 'description' => $description,
- );
- $rssObj->_addEntry($data);
+ /* @var $product Mage_Catalog_Model_Product */
+ foreach ($this->getWishlistItems() as $product) {
+ $description = ' '
+ . '' . $this->htmlEscape($product->getShortDescription()) . '';
+ if ($product->getPrice() != $product->getFinalPrice()) {
+ $description .= Mage::helper('catalog')->__('Regular Price:') . ' '
+ . Mage::helper('core')->currency($product->getPrice()) . ' '
+ . Mage::helper('catalog')->__('Special Price:') . ' '
+ . Mage::helper('core')->currency($product->getFinalPrice()).' ';
+ }
+ else {
+ $description .= Mage::helper('catalog')->__('Price:') . ' '
+ . Mage::helper('core')->currency($product->getFinalPrice());
+ }
+ $description .= '
';
+ if ($this->hasDescription($product)) {
+ $description .= '' . Mage::helper('wishlist')->__('Comment:')
+ . ' ' . $this->getEscapedDescription($product) . '
';
}
- }
+ $description .= '
';
- } else {
- $data = array('title' => Mage::helper('rss')->__('Cannot retrieve the wishlist'),
- 'description' => Mage::helper('rss')->__('Cannot retrieve the wishlist'),
- 'link' => Mage::getUrl(),
- 'charset' => 'UTF-8',
- );
- $rssObj->_addHeader($data);
+ $rssObj->_addEntry(array(
+ 'title' => $product->getName(),
+ 'link' => $this->getProductUrl($product),
+ 'description' => $description,
+ ));
+ }
+ }
+ else {
+ $rssObj->_addHeader(array(
+ 'title' => Mage::helper('rss')->__('Cannot retrieve the wishlist'),
+ 'description' => Mage::helper('rss')->__('Cannot retrieve the wishlist'),
+ 'link' => Mage::getUrl(),
+ 'charset' => 'UTF-8',
+ ));
}
+
return $rssObj->createRssXml();
}
-}
\ No newline at end of file
+ /**
+ * Retrieve Product View URL
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @param array $additional
+ * @return string
+ */
+ public function getProductUrl($product, $additional = array())
+ {
+ $additional['_rss'] = true;
+ return parent::getProductUrl($product, $additional);
+ }
+}
diff --git a/app/code/core/Mage/Rule/Model/Rule.php b/app/code/core/Mage/Rule/Model/Rule.php
index 86eb0c0682..4ddb5a6014 100644
--- a/app/code/core/Mage/Rule/Model/Rule.php
+++ b/app/code/core/Mage/Rule/Model/Rule.php
@@ -244,10 +244,13 @@ protected function _afterLoad()
$this->getActions()->loadArray($actionsArr);
}
- $this->setWebsiteIds(explode(',',$this->getWebsiteIds()));
+ $websiteIds = $this->getWebsiteIds();
+ if (is_string($websiteIds)) {
+ $this->setWebsiteIds(explode(',', $websiteIds));
+ }
$groupIds = $this->getCustomerGroupIds();
if (is_string($groupIds)) {
- $this->setCustomerGroupIds(explode(',',$groupIds));
+ $this->setCustomerGroupIds(explode(',', $groupIds));
}
}
diff --git a/app/code/core/Mage/Sales/Block/Order/Creditmemo.php b/app/code/core/Mage/Sales/Block/Order/Creditmemo.php
index 2fa4862151..000cec8a28 100644
--- a/app/code/core/Mage/Sales/Block/Order/Creditmemo.php
+++ b/app/code/core/Mage/Sales/Block/Order/Creditmemo.php
@@ -31,7 +31,7 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-class Mage_Sales_Block_Order_Creditmemo extends Mage_Core_Block_Template
+class Mage_Sales_Block_Order_Creditmemo extends Mage_Sales_Block_Order_Creditmemo_Items
{
protected function _construct()
{
diff --git a/app/code/core/Mage/Sales/Block/Order/Creditmemo/Items.php b/app/code/core/Mage/Sales/Block/Order/Creditmemo/Items.php
index e7ab02804d..2bf085999b 100644
--- a/app/code/core/Mage/Sales/Block/Order/Creditmemo/Items.php
+++ b/app/code/core/Mage/Sales/Block/Order/Creditmemo/Items.php
@@ -43,11 +43,30 @@ public function getOrder()
return Mage::registry('current_order');
}
- public function getPrintCreditmemoUrl($creditmemo){
+ public function getPrintCreditmemoUrl($creditmemo)
+ {
return Mage::getUrl('*/*/printCreditmemo', array('creditmemo_id' => $creditmemo->getId()));
}
- public function getPrintAllCreditmemosUrl($order){
+ public function getPrintAllCreditmemosUrl($order)
+ {
return Mage::getUrl('*/*/printCreditmemo', array('order_id' => $order->getId()));
}
+
+ /**
+ * Get creditmemo totals block html
+ *
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
+ * @return string
+ */
+ public function getTotalsHtml($creditmemo)
+ {
+ $totals = $this->getChild('creditmemo_totals');
+ $html = '';
+ if ($totals) {
+ $totals->setCreditmemo($creditmemo);
+ $html = $totals->toHtml();
+ }
+ return $html;
+ }
}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Block/Order/Creditmemo/Totals.php b/app/code/core/Mage/Sales/Block/Order/Creditmemo/Totals.php
new file mode 100644
index 0000000000..99c262960e
--- /dev/null
+++ b/app/code/core/Mage/Sales/Block/Order/Creditmemo/Totals.php
@@ -0,0 +1,109 @@
+_creditmemo === null) {
+ if ($this->hasData('creditmemo')) {
+ $this->_creditmemo = $this->_getData('creditmemo');
+ } elseif (Mage::registry('current_creditmemo')) {
+ $this->_creditmemo = Mage::registry('current_creditmemo');
+ } elseif ($this->getParentBlock()->getCreditmemo()) {
+ $this->_creditmemo = $this->getParentBlock()->getCreditmemo();
+ }
+ }
+ return $this->_creditmemo;
+ }
+
+ public function setCreditmemo($creditmemo)
+ {
+ $this->_creditmemo = $creditmemo;
+ return $this;
+ }
+
+ /**
+ * Get totals source object
+ *
+ * @return Mage_Sales_Model_Order
+ */
+ public function getSource()
+ {
+ return $this->getCreditmemo();
+ }
+
+ /**
+ * Initialize order totals array
+ *
+ * @return Mage_Sales_Block_Order_Totals
+ */
+ protected function _initTotals()
+ {
+ parent::_initTotals();
+ $this->removeTotal('base_grandtotal');
+ if ((float) $this->getSource()->getAdjustmentPositive()) {
+ $total = new Varien_Object(array(
+ 'code' => 'adjustment_positive',
+ 'value' => $this->getSource()->getAdjustmentPositive(),
+ 'label' => $this->__('Adjustment Refund')
+ ));
+ $this->addTotal($total);
+ }
+ if ((float) $this->getSource()->getAdjustmentNegative()) {
+ $total = new Varien_Object(array(
+ 'code' => 'adjustment_negative',
+ 'value' => $this->getSource()->getAdjustmentNegative(),
+ 'label' => $this->__('Adjustment Fee')
+ ));
+ $this->addTotal($total);
+ }
+ /**
+ getCanDisplayTotalPaid()): ?>
+
+ __('Total Paid') ?>
+ formatPrice($_creditmemo->getTotalPaid()) ?>
+
+
+ getCanDisplayTotalRefunded()): ?>
+
+ __('Total Refunded') ?>
+ formatPrice($_creditmemo->getTotalRefunded()) ?>
+
+
+ getCanDisplayTotalDue()): ?>
+
+ __('Total Due') ?>
+ formatPrice($_creditmemo->getTotalDue()) ?>
+
+
+ */
+ return $this;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Block/Order/Invoice.php b/app/code/core/Mage/Sales/Block/Order/Invoice.php
index da920969f8..2c73146049 100644
--- a/app/code/core/Mage/Sales/Block/Order/Invoice.php
+++ b/app/code/core/Mage/Sales/Block/Order/Invoice.php
@@ -31,7 +31,7 @@
* @package Mage_Sales
* @author Magento Core Team
*/
-class Mage_Sales_Block_Order_Invoice extends Mage_Core_Block_Template
+class Mage_Sales_Block_Order_Invoice extends Mage_Sales_Block_Order_Invoice_Items
{
protected function _construct()
{
diff --git a/app/code/core/Mage/Sales/Block/Order/Invoice/Items.php b/app/code/core/Mage/Sales/Block/Order/Invoice/Items.php
index eb137e86aa..9b7ba601b5 100644
--- a/app/code/core/Mage/Sales/Block/Order/Invoice/Items.php
+++ b/app/code/core/Mage/Sales/Block/Order/Invoice/Items.php
@@ -43,11 +43,30 @@ public function getOrder()
return Mage::registry('current_order');
}
- public function getPrintInvoiceUrl($invoice){
+ public function getPrintInvoiceUrl($invoice)
+ {
return Mage::getUrl('*/*/printInvoice', array('invoice_id' => $invoice->getId()));
}
- public function getPrintAllInvoicesUrl($order){
+ public function getPrintAllInvoicesUrl($order)
+ {
return Mage::getUrl('*/*/printInvoice', array('order_id' => $order->getId()));
}
+
+ /**
+ * Get html of invoice totals block
+ *
+ * @param Mage_Sales_Model_Order_Invoice $invoice
+ * @return string
+ */
+ public function getInvoiceTotalsHtml($invoice)
+ {
+ $html = '';
+ $totals = $this->getChild('invoice_totals');
+ if ($totals) {
+ $totals->setInvoice($invoice);
+ $html = $totals->toHtml();
+ }
+ return $html;
+ }
}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Block/Order/Invoice/Totals.php b/app/code/core/Mage/Sales/Block/Order/Invoice/Totals.php
new file mode 100644
index 0000000000..c07762d7b7
--- /dev/null
+++ b/app/code/core/Mage/Sales/Block/Order/Invoice/Totals.php
@@ -0,0 +1,73 @@
+_invoice === null) {
+ if ($this->hasData('invoice')) {
+ $this->_invoice = $this->_getData('invoice');
+ } elseif (Mage::registry('current_invoice')) {
+ $this->_invoice = Mage::registry('current_invoice');
+ } elseif ($this->getParentBlock()->getInvoice()) {
+ $this->_invoice = $this->getParentBlock()->getInvoice();
+ }
+ }
+ return $this->_invoice;
+ }
+
+ public function setInvoice($invoice)
+ {
+ $this->_invoice = $invoice;
+ return $this;
+ }
+
+ /**
+ * Get totals source object
+ *
+ * @return Mage_Sales_Model_Order
+ */
+ public function getSource()
+ {
+ return $this->getInvoice();
+ }
+
+ /**
+ * Initialize order totals array
+ *
+ * @return Mage_Sales_Block_Order_Totals
+ */
+ protected function _initTotals()
+ {
+ parent::_initTotals();
+ $this->removeTotal('base_grandtotal');
+ return $this;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Block/Order/Print/Creditmemo.php b/app/code/core/Mage/Sales/Block/Order/Print/Creditmemo.php
index f0f9f77c59..b674df12d7 100644
--- a/app/code/core/Mage/Sales/Block/Order/Print/Creditmemo.php
+++ b/app/code/core/Mage/Sales/Block/Order/Print/Creditmemo.php
@@ -34,12 +34,6 @@
class Mage_Sales_Block_Order_Print_Creditmemo extends Mage_Sales_Block_Items_Abstract
{
-
- public function __construct()
- {
- parent::__construct();
- }
-
protected function _prepareLayout()
{
if ($headBlock = $this->getLayout()->getBlock('head')) {
@@ -79,8 +73,23 @@ public function getCreditmemo()
protected function _prepareItem(Mage_Core_Block_Abstract $renderer)
{
$renderer->setPrintStatus(true);
-
return parent::_prepareItem($renderer);
}
-}
+ /**
+ * Get Creditmemo totals block html gor specific creditmemo
+ *
+ * @param Mage_Sales_Model_Order_Creditmemo $creditmemo
+ * @return string
+ */
+ public function getTotalsHtml($creditmemo)
+ {
+ $totals = $this->getChild('creditmemo_totals');
+ $html = '';
+ if ($totals) {
+ $totals->setCreditmemo($creditmemo);
+ $html = $totals->toHtml();
+ }
+ return $html;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Block/Order/Print/Invoice.php b/app/code/core/Mage/Sales/Block/Order/Print/Invoice.php
index f902c025de..3e983abfdf 100644
--- a/app/code/core/Mage/Sales/Block/Order/Print/Invoice.php
+++ b/app/code/core/Mage/Sales/Block/Order/Print/Invoice.php
@@ -34,12 +34,6 @@
class Mage_Sales_Block_Order_Print_Invoice extends Mage_Sales_Block_Items_Abstract
{
-
- public function __construct()
- {
- parent::__construct();
- }
-
protected function _prepareLayout()
{
if ($headBlock = $this->getLayout()->getBlock('head')) {
@@ -79,8 +73,25 @@ public function getInvoice()
protected function _prepareItem(Mage_Core_Block_Abstract $renderer)
{
$renderer->setPrintStatus(true);
-
return parent::_prepareItem($renderer);
}
+
+ /**
+ * Get html of invoice totlas block
+ *
+ * @param Mage_Sales_Model_Order_Invoice $invoice
+ * @return string
+ */
+ public function getInvoiceTotalsHtml($invoice)
+ {
+ $html = '';
+ $totals = $this->getChild('invoice_totals');
+ if ($totals) {
+ $totals->setInvoice($invoice);
+ $html = $totals->toHtml();
+ }
+ return $html;
+ }
+
}
diff --git a/app/code/core/Mage/Sales/Block/Order/Tax.php b/app/code/core/Mage/Sales/Block/Order/Tax.php
index 05b36f0b45..1c5fa765cc 100644
--- a/app/code/core/Mage/Sales/Block/Order/Tax.php
+++ b/app/code/core/Mage/Sales/Block/Order/Tax.php
@@ -27,6 +27,7 @@
/**
* Sales order view tax block
*
+ * @deprecated after 1.3.2.2
* @category Mage
* @package Mage_Sales
* @author Magento Core Team
diff --git a/app/code/core/Mage/Sales/Block/Order/Totals.php b/app/code/core/Mage/Sales/Block/Order/Totals.php
new file mode 100644
index 0000000000..3f55e98590
--- /dev/null
+++ b/app/code/core/Mage/Sales/Block/Order/Totals.php
@@ -0,0 +1,303 @@
+ $totalObject
+ * )
+ *
+ * @var array
+ */
+ protected $_totals;
+ protected $_order = null;
+
+ /**
+ * Initialize self totals and children blocks totals before html building
+ *
+ * @return Mage_Sales_Block_Order_Totals
+ */
+ protected function _beforeToHtml()
+ {
+ $this->_initTotals();
+ foreach ($this->getChild() as $child) {
+ if (method_exists($child, 'initTotals')) {
+ $child->initTotals();
+ }
+ }
+ return parent::_beforeToHtml();
+ }
+
+ /**
+ * Get order object
+ *
+ * @return Mage_Sales_Model_Order
+ */
+ public function getOrder()
+ {
+ if ($this->_order === null) {
+ if ($this->hasData('order')) {
+ $this->_order = $this->_getData('order');
+ } elseif (Mage::registry('current_order')) {
+ $this->_order = Mage::registry('current_order');
+ } elseif ($this->getParentBlock()->getOrder()) {
+ $this->_order = $this->getParentBlock()->getOrder();
+ }
+ }
+ return $this->_order;
+ }
+
+ public function setOrder($order)
+ {
+ $this->_order = $order;
+ return $this;
+ }
+
+ /**
+ * Get totals source object
+ *
+ * @return Mage_Sales_Model_Order
+ */
+ public function getSource()
+ {
+ return $this->getOrder();
+ }
+
+ /**
+ * Initialize order totals array
+ *
+ * @return Mage_Sales_Block_Order_Totals
+ */
+ protected function _initTotals()
+ {
+ $this->_totals = array();
+ $this->_totals['subtotal'] = new Varien_Object(array(
+ 'code' => 'subtotal',
+ 'value' => $this->getSource()->getSubtotal(),
+ 'label' => $this->__('Subtotal')
+ ));
+
+ /**
+ * Add shipping
+ */
+ if ($this->getSource()->getShippingAmount() || $this->getSource()->getShippingDescription())
+ {
+ $this->_totals['shipping'] = new Varien_Object(array(
+ 'code' => 'shipping',
+ 'field' => 'shipping_amount',
+ 'value' => $this->getSource()->getShippingAmount(),
+ 'label' => $this->__('Shipping & Handling')
+ ));
+ }
+
+ /**
+ * Add discount
+ */
+ if (((float)$this->getSource()->getDiscountAmount()) != 0) {
+ if ($this->getSource()->getDiscountDescription()) {
+ $discountLabel = $this->__('Discount (%s)', $this->getSource()->getDiscountDescription());
+ } else {
+ $discountLabel = $this->__('Discount');
+ }
+ $this->_totals['discount'] = new Varien_Object(array(
+ 'code' => 'discount',
+ 'field' => 'discount_amount',
+ 'value' => $this->getSource()->getDiscountAmount(),
+ 'label' => $discountLabel
+ ));
+ }
+
+ $this->_totals['grand_total'] = new Varien_Object(array(
+ 'code' => 'grand_total',
+ 'field' => 'grand_total',
+ 'strong'=> true,
+ 'value' => $this->getSource()->getGrandTotal(),
+ 'label' => $this->__('Grand Total')
+ ));
+
+ /**
+ * Base grandtotal
+ */
+ if ($this->getOrder()->isCurrencyDifferent()) {
+ $this->_totals['base_grandtotal'] = new Varien_Object(array(
+ 'code' => 'base_grandtotal',
+ 'value' => $this->getOrder()->formatBasePrice($this->getSource()->getBaseGrandTotal()),
+ 'label' => $this->__('Grand Total to be charged'),
+ 'is_formated' => true,
+ ));
+ }
+ return $this;
+ }
+
+ /**
+ * Add new total to totals array after specific total or before last total by default
+ *
+ * @param Varien_Object $total
+ * @param null|string|last|first $after
+ * @return Mage_Sales_Block_Order_Totals
+ */
+ public function addTotal(Varien_Object $total, $after=null)
+ {
+ if ($after !== null && $after != 'last' && $after != 'first') {
+ $totals = array();
+ $added = false;
+ foreach ($this->_totals as $code => $item) {
+ $totals[$code] = $item;
+ if ($code == $after) {
+ $added = true;
+ $totals[$total->getCode()] = $total;
+ }
+ }
+ if (!$added) {
+ $last = array_pop($totals);
+ $totals[$total->getCode()] = $total;
+ $totals[$last->getCode()] = $last;
+ }
+ $this->_totals = $totals;
+ } elseif ($after=='last') {
+ $this->_totals[$total->getCode()] = $total;
+ } elseif ($after=='first') {
+ $totals = array($total->getCode()=>$total);
+ $this->_totals = array_merge($totals, $this->_totals);
+ } else {
+ $last = array_pop($this->_totals);
+ $this->_totals[$total->getCode()] = $total;
+ $this->_totals[$last->getCode()] = $last;
+ }
+ return $this;
+ }
+
+ /**
+ * Add new total to totals array before specific total or after first total by default
+ *
+ * @param Varien_Object $total
+ * @param null|string $after
+ * @return Mage_Sales_Block_Order_Totals
+ */
+ public function addTotalBefore(Varien_Object $total, $before=null)
+ {
+ if ($before !== null) {
+ if (isset($this->_totals[$before])) {
+ $totals = array();
+ foreach ($this->_totals as $code => $item) {
+ if ($code == $before) {
+ $totals[$total->getCode()] = $total;
+ }
+ $totals[$code] = $item;
+ }
+ $this->_totals = $totals;
+ return $this;
+ }
+ }
+ $totals = array();
+ $first = array_shift($this->_totals);
+ $totals[$first->getCode()] = $first;
+ $totals[$total->getCode()] = $total;
+ foreach ($this->_totals as $code => $item) {
+ $totals[$code] = $item;
+ }
+ $this->_totals = $totals;
+ return $this;
+ }
+
+ /**
+ * Get Total object by code
+ *
+ * @@return Varien_Object
+ */
+ public function getTotal($code)
+ {
+ if (isset($this->_totals[$code])) {
+ return $this->_totals[$code];
+ }
+ return false;
+ }
+
+ /**
+ * Delete total by specific
+ *
+ * @param string $code
+ * @return Mage_Sales_Block_Order_Totals
+ */
+ public function removeTotal($code)
+ {
+ unset($this->_totals[$code]);
+ return $this;
+ }
+
+ /**
+ * Apply sort orders to totals array.
+ * Array should have next structure
+ * array(
+ * $totalCode => $totalSortOrder
+ * )
+ *
+ *
+ * @param array $order
+ * @return Mage_Sales_Block_Order_Totals
+ */
+ public function applySortOrder($order)
+ {
+ return $this;
+ }
+
+ /**
+ * get totals array for visualization
+ *
+ * @return array
+ */
+ public function getTotals($area=null)
+ {
+ $totals = array();
+ if ($area === null) {
+ $totals = $this->_totals;
+ } else {
+ $area = (string)$area;
+ foreach ($this->_totals as $total) {
+ $totalArea = (string) $total->getArea();
+ if ($totalArea == $area) {
+ $totals[] = $total;
+ }
+ }
+ }
+ return $totals;
+ }
+
+ /**
+ * Format total value based on order currency
+ *
+ * @param Varien_Object $total
+ * @return string
+ */
+ public function formatValue($total)
+ {
+ if (!$total->getIsFormated()) {
+ return $this->getOrder()->formatPrice($total->getValue());
+ }
+ return $total->getValue();
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Model/Convert/Order.php b/app/code/core/Mage/Sales/Model/Convert/Order.php
index 55d721ff47..a21b18bba5 100644
--- a/app/code/core/Mage/Sales/Model/Convert/Order.php
+++ b/app/code/core/Mage/Sales/Model/Convert/Order.php
@@ -87,7 +87,6 @@ public function toQuote(Mage_Sales_Model_Order $order, $quote=null)
// * Another data
// */
// ->setCouponCode($order->getCouponCode())
-// ->setGiftcertCode($order->getGiftcertCode())
// ->setAppliedRuleIds($order->getAppliedRuleIds());
// //->collectTotals();
//
@@ -116,7 +115,6 @@ public function toQuoteShippingAddress(Mage_Sales_Model_Order $order)
// ->setTaxAmount($order->getTaxAmount())
// ->setDiscountAmount($order->getDiscountAmount())
// ->setShippingAmount($order->getShippingAmount())
-// ->setGiftcertAmount($order->getGiftcertAmount())
// ->setCustbalanceAmount($order->getCustbalanceAmount())
// ->setGrandTotal($order->getGrandTotal())
//
@@ -124,7 +122,6 @@ public function toQuoteShippingAddress(Mage_Sales_Model_Order $order)
// ->setBaseTaxAmount($order->getBaseTaxAmount())
// ->setBaseDiscountAmount($order->getBaseDiscountAmount())
// ->setBaseShippingAmount($order->getBaseShippingAmount())
-// ->setBaseGiftcertAmount($order->getBaseGiftcertAmount())
// ->setBaseCustbalanceAmount($order->getBaseCustbalanceAmount())
// ->setBaseGrandTotal($order->getBaseGrandTotal());
return $address;
diff --git a/app/code/core/Mage/Sales/Model/Convert/Quote.php b/app/code/core/Mage/Sales/Model/Convert/Quote.php
index 09d3cf5f2c..8a5b9ced04 100644
--- a/app/code/core/Mage/Sales/Model/Convert/Quote.php
+++ b/app/code/core/Mage/Sales/Model/Convert/Quote.php
@@ -96,7 +96,6 @@ public function toOrder(Mage_Sales_Model_Quote $quote, $order=null)
// * Another data
// */
// ->setCouponCode($quote->getCouponCode())
-// ->setGiftcertCode($quote->getGiftcertCode())
// ->setIsVirtual($quote->getIsVirtual())
// ->setIsMultiPayment($quote->getIsMultiPayment())
// ->setAppliedRuleIds($quote->getAppliedRuleIds());
@@ -131,7 +130,6 @@ public function addressToOrder(Mage_Sales_Model_Quote_Address $address, $order=n
// ->setDiscountAmount($address->getDiscountAmount())
// ->setShippingAmount($address->getShippingAmount())
// ->setShippingTaxAmount($address->getShippingTaxAmount())
-// ->setGiftcertAmount($address->getGiftcertAmount())
// ->setCustbalanceAmount($address->getCustbalanceAmount())
// ->setGrandTotal($address->getGrandTotal())
//
@@ -140,7 +138,6 @@ public function addressToOrder(Mage_Sales_Model_Quote_Address $address, $order=n
// ->setBaseDiscountAmount($address->getBaseDiscountAmount())
// ->setBaseShippingAmount($address->getBaseShippingAmount())
// ->setBaseShippingTaxAmount($address->getBaseShippingTaxAmount())
-// ->setBaseGiftcertAmount($address->getBaseGiftcertAmount())
// ->setBaseCustbalanceAmount($address->getBaseCustbalanceAmount())
// ->setBaseGrandTotal($address->getBaseGrandTotal());
diff --git a/app/code/core/Mage/Sales/Model/Entity/Setup.php b/app/code/core/Mage/Sales/Model/Entity/Setup.php
index 60de406f72..1f166bb471 100644
--- a/app/code/core/Mage/Sales/Model/Entity/Setup.php
+++ b/app/code/core/Mage/Sales/Model/Entity/Setup.php
@@ -290,7 +290,6 @@ public function getDefaultEntities()
'coupon_code' => array(),
'applied_rule_ids' => array(),
- 'giftcert_code' => array(),
'global_currency_code' => array(),
'base_currency_code' => array(),
@@ -311,7 +310,6 @@ public function getDefaultEntities()
'tax_amount' => array('type'=>'static'),
'shipping_amount' => array('type'=>'static'),
'discount_amount' => array('type'=>'static'),
- 'giftcert_amount' => array('type'=>'decimal'),
'custbalance_amount'=> array('type'=>'decimal'),
'subtotal' => array('type'=>'static'),
@@ -330,7 +328,6 @@ public function getDefaultEntities()
'base_tax_amount' => array('type'=>'static'),
'base_shipping_amount' => array('type'=>'static'),
'base_discount_amount' => array('type'=>'static'),
- 'base_giftcert_amount' => array('type'=>'decimal'),
'base_custbalance_amount'=> array('type'=>'decimal'),
'base_subtotal' => array('type'=>'static'),
diff --git a/app/code/core/Mage/Sales/Model/Mysql4/Setup.php b/app/code/core/Mage/Sales/Model/Mysql4/Setup.php
index 4c2846469d..25fa721aac 100644
--- a/app/code/core/Mage/Sales/Model/Mysql4/Setup.php
+++ b/app/code/core/Mage/Sales/Model/Mysql4/Setup.php
@@ -343,7 +343,6 @@ public function getDefaultEntities()
'coupon_code' => array(),
'applied_rule_ids' => array(),
- 'giftcert_code' => array(),
'global_currency_code' => array(),
'base_currency_code' => array(),
@@ -364,7 +363,6 @@ public function getDefaultEntities()
'shipping_amount' => array('type'=>'static'),
'shipping_tax_amount' => array('type'=>'static'),
'discount_amount' => array('type'=>'static'),
- 'giftcert_amount' => array('type'=>'decimal'),
'subtotal' => array('type'=>'static'),
'grand_total' => array('type'=>'static'),
@@ -383,7 +381,6 @@ public function getDefaultEntities()
'base_shipping_amount' => array('type'=>'static'),
'base_shipping_tax_amount' => array('type'=>'static'),
'base_discount_amount' => array('type'=>'static'),
- 'base_giftcert_amount' => array('type'=>'decimal'),
'base_subtotal' => array('type'=>'static'),
'base_grand_total' => array('type'=>'static'),
diff --git a/app/code/core/Mage/Sales/Model/Order.php b/app/code/core/Mage/Sales/Model/Order.php
index 88b8d3e5d0..0b17f7a7a0 100644
--- a/app/code/core/Mage/Sales/Model/Order.php
+++ b/app/code/core/Mage/Sales/Model/Order.php
@@ -1116,7 +1116,7 @@ public function getRealOrderId()
}
/**
- * Retrieve order currency model instance
+ * Get currency model instance. Will be used currency with which order placed
*
* @return Mage_Directory_Model_Currency
*/
@@ -1129,7 +1129,7 @@ public function getOrderCurrency()
}
/**
- * Retrieve formated price value includeing order rate
+ * Get formated price value including order currency rate to order website currency
*
* @param float $price
* @param bool $addBrackets
@@ -1137,7 +1137,12 @@ public function getOrderCurrency()
*/
public function formatPrice($price, $addBrackets = false)
{
- return $this->getOrderCurrency()->format($price, array(), true, $addBrackets);
+ return $this->formatPricePrecision($price, 2, $addBrackets);
+ }
+
+ public function formatPricePrecision($price, $precision, $addBrackets = false)
+ {
+ return $this->getOrderCurrency()->formatPrecision($price, $precision, array(), true, $addBrackets);
}
/**
@@ -1166,7 +1171,7 @@ public function getBaseCurrency()
/**
* Retrieve order website currency for working with base prices
- * Deprecated method, please use getBaseCurrency instead.
+ * @deprecated please use getBaseCurrency instead.
*
* @return Mage_Directory_Model_Currency
*/
@@ -1177,7 +1182,12 @@ public function getStoreCurrency()
public function formatBasePrice($price)
{
- return $this->getBaseCurrency()->format($price);
+ return $this->formatBasePricePrecision($price, 2);
+ }
+
+ public function formatBasePricePrecision($price, $precision)
+ {
+ return $this->getBaseCurrency()->formatPrecision($price, $precision);
}
public function isCurrencyDifferent()
@@ -1518,8 +1528,10 @@ public function prepareInvoice($qtys = array())
} else {
if (isset($qtys[$orderItem->getId()])) {
$qty = $qtys[$orderItem->getId()];
- } else {
+ } elseif (!count($qtys)) {
$qty = $orderItem->getQtyToInvoice();
+ } else {
+ continue;
}
}
@@ -1554,8 +1566,10 @@ public function prepareShipment($qtys = array())
} else {
if (isset($qtys[$orderItem->getId()])) {
$qty = $qtys[$orderItem->getId()];
- } else {
+ } elseif (!count($qtys)) {
$qty = $orderItem->getQtyToShip();
+ } else {
+ continue;
}
}
diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php
index aa27b0ff3a..2d71a340f5 100644
--- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php
+++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Item.php
@@ -150,11 +150,40 @@ public function cancel()
*/
public function calcRowTotal()
{
- $rowTotal = $this->getOrderItem()->getRowTotal()/$this->getOrderItem()->getQtyOrdered()*$this->getQty();
- $baseRowTotal = $this->getOrderItem()->getBaseRowTotal()/$this->getOrderItem()->getQtyOrdered()*$this->getQty();
-
- $this->setRowTotal($this->getCreditmemo()->getStore()->roundPrice($rowTotal));
- $this->setBaseRowTotal($this->getCreditmemo()->getStore()->roundPrice($baseRowTotal));
+ $store = $this->getCreditmemo()->getStore();
+ $orderItem = $this->getOrderItem();
+ $orderItemQty = $orderItem->getQtyOrdered();
+
+ $rowTotal = $orderItem->getRowTotal();
+ $baseRowTotal = $orderItem->getBaseRowTotal();
+ $rowTotalInclTax = $orderItem->getRowTotalInclTax();
+ $baseRowTotalInclTax= $orderItem->getBaseRowTotalInclTax();
+
+ $rowTotal = $rowTotal/$orderItemQty*$this->getQty();
+ $baseRowTotal = $baseRowTotal/$orderItemQty*$this->getQty();
+
+ $this->setRowTotal($store->roundPrice($rowTotal));
+ $this->setBaseRowTotal($store->roundPrice($baseRowTotal));
+
+ if ($rowTotalInclTax && $baseRowTotalInclTax) {
+ $this->setRowTotalInclTax($store->roundPrice($rowTotalInclTax/$orderItemQty*$this->getQty()));
+ $this->setBaseRowTotalInclTax($store->roundPrice($baseRowTotalInclTax/$orderItemQty*$this->getQty()));
+ }
return $this;
}
+
+ /**
+ * Checking if the item is last
+ *
+ * @return bool
+ */
+ public function isLast()
+ {
+ $orderItem = $this->getOrderItem();
+ if ($this->getQty() == $orderItem->getQtyToRefund() && !$orderItem->getQtyToInvoice()) {
+ return true;
+ }
+ return false;
+ }
+
}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Grand.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Grand.php
index 22665f8868..3a74009440 100644
--- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Grand.php
+++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Grand.php
@@ -32,9 +32,6 @@ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
$grandTotal = $creditmemo->getGrandTotal();
$baseGrandTotal = $creditmemo->getBaseGrandTotal();
- $grandTotal+= $creditmemo->getShippingAmount();
- $baseGrandTotal+= $creditmemo->getBaseShippingAmount();
-
$grandTotal+= $creditmemo->getAdjustmentPositive();
$baseGrandTotal+= $creditmemo->getBaseAdjustmentPositive();
diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Shipping.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Shipping.php
new file mode 100644
index 0000000000..35863cc944
--- /dev/null
+++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Shipping.php
@@ -0,0 +1,71 @@
+
+ */
+class Mage_Sales_Model_Order_Creditmemo_Total_Shipping extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
+{
+ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
+ {
+ $order = $creditmemo->getOrder();
+ $allowedAmount = $order->getShippingAmount()-$order->getShippingRefunded();
+ $baseAllowedAmount = $order->getBaseShippingAmount()-$order->getBaseShippingRefunded();
+
+ /**
+ * Check if shipping amount was specified (from invoice or another source)
+ */
+ $baseShippingAmount = $creditmemo->getBaseShippingAmount();
+ if ($baseShippingAmount) {
+ $baseShippingAmount = Mage::app()->getStore()->roundPrice($baseShippingAmount);
+ if ($baseShippingAmount<$baseAllowedAmount) {
+ $shippingAmount = $allowedAmount*$baseShippingAmount/$baseAllowedAmount;
+ $shippingAmount = Mage::app()->getStore()->roundPrice($shippingAmount);
+ } elseif ($baseShippingAmount==$baseAllowedAmount) {
+ $shippingAmount = $allowedAmount;
+ } else {
+ $baseAllowedAmount = $order->formatBasePrice($baseAllowedAmount);
+ Mage::throwException(
+ Mage::helper('sales')->__('Maximum shipping amount allowed to refound is: %s', $baseAllowedAmount)
+ );
+ }
+ } else {
+ $baseShippingAmount = $baseAllowedAmount;
+ $shippingAmount = $allowedAmount;
+ }
+
+ $creditmemo->setShippingAmount($shippingAmount);
+ $creditmemo->setBaseShippingAmount($baseShippingAmount);
+
+ $creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$shippingAmount);
+ $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$baseShippingAmount);
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Subtotal.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Subtotal.php
index 5b1e3af701..9457c3ca50 100644
--- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Subtotal.php
+++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Subtotal.php
@@ -37,18 +37,26 @@ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$subtotal = 0;
$baseSubtotal = 0;
+ $subtotalInclTax= 0;
+ $baseSubtotalInclTax = 0;
foreach ($creditmemo->getAllItems() as $item) {
$item->calcRowTotal();
+
if ($item->getOrderItem()->isDummy()) {
continue;
}
- $subtotal+= $item->getRowTotal();
- $baseSubtotal+= $item->getBaseRowTotal();
+
+ $subtotal += $item->getRowTotal();
+ $baseSubtotal += $item->getBaseRowTotal();
+ $subtotalInclTax+= $item->getRowTotalInclTax();
+ $baseSubtotalInclTax += $item->getBaseRowTotalInclTax();
}
$creditmemo->setSubtotal($subtotal);
$creditmemo->setBaseSubtotal($baseSubtotal);
+ $creditmemo->setSubtotalInclTax($subtotalInclTax);
+ $creditmemo->setBaseSubtotalInclTax($baseSubtotalInclTax);
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $subtotal);
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $baseSubtotal);
diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Tax.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Tax.php
index 435678d8f7..68b29cc03a 100644
--- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Tax.php
+++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Total/Tax.php
@@ -33,6 +33,7 @@ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
$baseShippingTaxAmount = 0;
$totalTax = 0;
$baseTotalTax = 0;
+ $order = $creditmemo->getOrder();
foreach ($creditmemo->getAllItems() as $item) {
if ($item->getOrderItem()->isDummy()) {
@@ -43,11 +44,20 @@ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
$orderItemQty = $item->getOrderItem()->getQtyOrdered();
if ($orderItemTax && $orderItemQty) {
- $tax = $orderItemTax*$item->getQty()/$orderItemQty;
- $baseTax = $baseOrderItemTax*$item->getQty()/$orderItemQty;
-
- $tax = $creditmemo->getStore()->roundPrice($tax);
- $baseTax = $creditmemo->getStore()->roundPrice($baseTax);
+ /**
+ * Check item tax amount
+ */
+ if ($item->isLast()) {
+ $tax = $orderItemTax - $item->getOrderItem()->getTaxRefunded();
+ $baseTax = $baseOrderItemTax - $item->getOrderItem()->getTaxRefunded();
+ }
+ else {
+ $tax = $orderItemTax*$item->getQty()/$orderItemQty;
+ $baseTax = $baseOrderItemTax*$item->getQty()/$orderItemQty;
+
+ $tax = $creditmemo->getStore()->roundPrice($tax);
+ $baseTax = $creditmemo->getStore()->roundPrice($baseTax);
+ }
$item->setTaxAmount($tax);
$item->setBaseTaxAmount($baseTax);
@@ -58,37 +68,36 @@ public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
}
if ($invoice = $creditmemo->getInvoice()) {
- $totalTax += $invoice->getShippingTaxAmount();
- $baseTotalTax += $invoice->getBaseShippingTaxAmount();
-
- $creditmemo->setShippingTaxAmount($invoice->getShippingTaxAmount());
- $creditmemo->setBaseShippingTaxAmount($invoice->getBaseShippingTaxAmount());
+ $totalTax += $invoice->getShippingTaxAmount();
+ $baseTotalTax += $invoice->getBaseShippingTaxAmount();
+ $shippingTaxAmount = $invoice->getShippingTaxAmount();
+ $baseShippingTaxAmount = $invoice->getBaseShippingTaxAmount();
} else {
- $shippingAmount = $creditmemo->getOrder()->getBaseShippingAmount();
- $shippingRefundedAmount = $creditmemo->getOrder()->getBaseShippingRefunded();
+ $orderShippingAmount = $order->getShippingAmount();
+ $baseOrderShippingAmount = $order->getBaseShippingAmount();
+ $baseOrderShippingRefundedAmount = $order->getBaseShippingRefunded();
$shippingTaxAmount = 0;
$baseShippingTaxAmount = 0;
- if (($shippingAmount - $shippingRefundedAmount) > $creditmemo->getShippingAmount()) {
- $shippingTaxAmount = $creditmemo->getShippingAmount()*($creditmemo->getOrder()->getShippingTaxAmount()/$shippingAmount);
- $baseShippingTaxAmount = $creditmemo->getBaseShippingAmount()*($creditmemo->getOrder()->getBaseShippingTaxAmount()/$shippingAmount);
+ if (($baseOrderShippingAmount - $baseOrderShippingRefundedAmount) > $creditmemo->getBaseShippingAmount()) {
+ $shippingTaxAmount = $creditmemo->getShippingAmount()*($order->getShippingTaxAmount()/$orderShippingAmount);
+ $baseShippingTaxAmount = $creditmemo->getBaseShippingAmount()*($order->getBaseShippingTaxAmount()/$baseOrderShippingAmount);
$shippingTaxAmount = $creditmemo->getStore()->roundPrice($shippingTaxAmount);
$baseShippingTaxAmount = $creditmemo->getStore()->roundPrice($baseShippingTaxAmount);
- } elseif (($shippingAmount - $shippingRefundedAmount) == $creditmemo->getShippingAmount()) {
- $shippingTaxAmount = $creditmemo->getOrder()->getShippingTaxAmount() - $creditmemo->getOrder()->getShippingTaxRefunded();
- $baseShippingTaxAmount = $creditmemo->getOrder()->getBaseShippingTaxAmount() - $creditmemo->getOrder()->getBaseShippingTaxRefunded();
+ } elseif (($baseOrderShippingAmount - $baseOrderShippingRefundedAmount) == $creditmemo->getBaseShippingAmount()) {
+ $shippingTaxAmount = $order->getShippingTaxAmount() - $order->getShippingTaxRefunded();
+ $baseShippingTaxAmount = $order->getBaseShippingTaxAmount() - $order->getBaseShippingTaxRefunded();
}
$totalTax += $shippingTaxAmount;
$baseTotalTax += $baseShippingTaxAmount;
}
+
+ $allowedTax = $order->getTaxAmount() - $order->getTaxRefunded();
+ $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxRefunded();;
- $tmpBaseTotalTax = $baseTotalTax - ($creditmemo->getOrder()->getBaseTaxRefunded() - $creditmemo->getOrder()->getBaseShippingTaxRefunded());
-
- if ($tmpBaseTotalTax<0) {
- $baseTotalTax = 0;
- $totalTax = 0;
- }
+ $totalTax = min($allowedTax, $totalTax);
+ $baseTotalTax = min($allowedBaseTax, $baseTotalTax);
$creditmemo->setTaxAmount($totalTax);
$creditmemo->setBaseTaxAmount($baseTotalTax);
diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php
index cd35d457fa..68dac8f56d 100644
--- a/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php
+++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Item.php
@@ -174,11 +174,25 @@ public function cancel()
*/
public function calcRowTotal()
{
- $rowTotal = $this->getOrderItem()->getRowTotal()/$this->getOrderItem()->getQtyOrdered()*$this->getQty();
- $baseRowTotal = $this->getOrderItem()->getBaseRowTotal()/$this->getOrderItem()->getQtyOrdered()*$this->getQty();
+ $store = $this->getInvoice()->getStore();
+ $orderItem = $this->getOrderItem();
+ $orderItemQty = $orderItem->getQtyOrdered();
- $this->setRowTotal($this->getInvoice()->getStore()->roundPrice($rowTotal));
- $this->setBaseRowTotal($this->getInvoice()->getStore()->roundPrice($baseRowTotal));
+ $rowTotal = $orderItem->getRowTotal();
+ $baseRowTotal = $orderItem->getBaseRowTotal();
+ $rowTotalInclTax = $orderItem->getRowTotalInclTax();
+ $baseRowTotalInclTax= $orderItem->getBaseRowTotalInclTax();
+
+ $rowTotal = $rowTotal/$orderItemQty*$this->getQty();
+ $baseRowTotal = $baseRowTotal/$orderItemQty*$this->getQty();
+
+ $this->setRowTotal($store->roundPrice($rowTotal));
+ $this->setBaseRowTotal($store->roundPrice($baseRowTotal));
+
+ if ($rowTotalInclTax && $baseRowTotalInclTax) {
+ $this->setRowTotalInclTax($store->roundPrice($rowTotalInclTax/$orderItemQty*$this->getQty()));
+ $this->setBaseRowTotalInclTax($store->roundPrice($baseRowTotalInclTax/$orderItemQty*$this->getQty()));
+ }
return $this;
}
diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php
index c8d9d82c69..36b9b4882c 100644
--- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php
+++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Subtotal.php
@@ -35,8 +35,10 @@ class Mage_Sales_Model_Order_Invoice_Total_Subtotal extends Mage_Sales_Model_Ord
*/
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
{
- $subtotal = 0;
- $baseSubtotal = 0;
+ $subtotal = 0;
+ $baseSubtotal = 0;
+ $subtotalInclTax= 0;
+ $baseSubtotalInclTax = 0;
foreach ($invoice->getAllItems() as $item) {
$item->calcRowTotal();
@@ -45,12 +47,16 @@ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
continue;
}
- $subtotal+= $item->getRowTotal();
- $baseSubtotal+= $item->getBaseRowTotal();
+ $subtotal += $item->getRowTotal();
+ $baseSubtotal += $item->getBaseRowTotal();
+ $subtotalInclTax+= $item->getRowTotalInclTax();
+ $baseSubtotalInclTax += $item->getBaseRowTotalInclTax();
}
$invoice->setSubtotal($subtotal);
$invoice->setBaseSubtotal($baseSubtotal);
+ $invoice->setSubtotalInclTax($subtotalInclTax);
+ $invoice->setBaseSubtotalInclTax($baseSubtotalInclTax);
$invoice->setGrandTotal($invoice->getGrandTotal() + $subtotal);
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $baseSubtotal);
diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php
index c71bacc59a..10af5688ab 100644
--- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php
+++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php
@@ -31,7 +31,7 @@ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
{
$totalTax = 0;
$baseTotalTax = 0;
-
+ $order = $invoice->getOrder();
foreach ($invoice->getAllItems() as $item) {
$orderItem = $item->getOrderItem();
$orderItemTax = $orderItem->getTaxAmount();
@@ -69,19 +69,24 @@ public function collect(Mage_Sales_Model_Order_Invoice $invoice)
/**
* Check shipping amount in previus invoices
*/
- foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) {
+ foreach ($order->getInvoiceCollection() as $previusInvoice) {
if ($previusInvoice->getShippingAmount() && !$previusInvoice->isCanceled()) {
$includeShippingTax = false;
}
}
if ($includeShippingTax) {
- $totalTax += $invoice->getOrder()->getShippingTaxAmount();
- $baseTotalTax += $invoice->getOrder()->getBaseShippingTaxAmount();
- $invoice->setShippingTaxAmount($invoice->getOrder()->getShippingTaxAmount());
- $invoice->setBaseShippingTaxAmount($invoice->getOrder()->getBaseShippingTaxAmount());
+ $totalTax += $order->getShippingTaxAmount();
+ $baseTotalTax += $order->getBaseShippingTaxAmount();
+ $invoice->setShippingTaxAmount($order->getShippingTaxAmount());
+ $invoice->setBaseShippingTaxAmount($order->getBaseShippingTaxAmount());
}
+ $allowedTax = $order->getTaxAmount() - $order->getTaxInvoiced();
+ $allowedBaseTax = $order->getBaseTaxAmount() - $order->getBaseTaxInvoiced();;
+
+ $totalTax = min($allowedTax, $totalTax);
+ $baseTotalTax = min($allowedBaseTax, $baseTotalTax);
$invoice->setTaxAmount($totalTax);
$invoice->setBaseTaxAmount($baseTotalTax);
diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php
index 7a43a01410..4b1a899e19 100644
--- a/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php
+++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Abstract.php
@@ -56,6 +56,8 @@ abstract class Mage_Sales_Model_Order_Pdf_Abstract extends Varien_Object
*/
protected $_pdf;
+ protected $_defaultTotalModel = 'sales/order_pdf_total_default';
+
/**
* Retrieve PDF
*
@@ -166,7 +168,7 @@ protected function insertAddress(&$page, $store = null)
protected function _formatAddress($address)
{
$return = array();
- foreach (split('\|', $address) as $str) {
+ foreach (explode('|', $address) as $str) {
foreach (Mage::helper('core/string')->str_split($str, 65, true, true) as $part) {
if (empty($part)) {
continue;
@@ -378,62 +380,60 @@ protected function _getTotalsList($source)
{
$totals = Mage::getConfig()->getNode('global/pdf/totals')->asArray();
usort($totals, array($this, '_sortTotalsList'));
+ $totalModels = array();
+ foreach ($totals as $index => $totalInfo) {
+ if (!empty($totalInfo['model'])) {
+ $totalModel = Mage::getModel($totalInfo['model']);
+ if ($totalModel instanceof Mage_Sales_Model_Order_Pdf_Total_Default) {
+ $totalInfo['model'] = $totalModel;
+ } else {
+ Mage::throwException(
+ Mage::helper('sales')->__('Pdf total model should extend Mage_Sales_Model_Order_Pdf_Total_Default')
+ );
+ }
+ } else {
+ $totalModel = Mage::getModel($this->_defaultTotalModel);
+ }
+ $totalModel->setData($totalInfo);
+ $totalModels[] = $totalModel;
+ }
- return $totals;
+ return $totalModels;
}
protected function insertTotals($page, $source){
$order = $source->getOrder();
-// $font = $this->_setFontBold($page);
-
$totals = $this->_getTotalsList($source);
-
$lineBlock = array(
'lines' => array(),
'height' => 15
);
foreach ($totals as $total) {
- $amount = $source->getDataUsingMethod($total['source_field']);
- $displayZero = (isset($total['display_zero']) ? $total['display_zero'] : 0);
-
- if ($amount != 0 || $displayZero) {
- $amount = $order->formatPriceTxt($amount);
-
- if (isset($total['amount_prefix']) && $total['amount_prefix']) {
- $amount = "{$total['amount_prefix']}{$amount}";
+ $total->setOrder($order)
+ ->setSource($source);
+
+ if ($total->canDisplay()) {
+ foreach ($total->getTotalsForDisplay() as $totalData) {
+ $lineBlock['lines'][] = array(
+ array(
+ 'text' => $totalData['label'],
+ 'feed' => 475,
+ 'align' => 'right',
+ 'font_size' => $totalData['font_size'],
+ 'font' => 'bold'
+ ),
+ array(
+ 'text' => $totalData['amount'],
+ 'feed' => 565,
+ 'align' => 'right',
+ 'font_size' => $totalData['font_size'],
+ 'font' => 'bold'
+ ),
+ );
}
-
- $fontSize = (isset($total['font_size']) ? $total['font_size'] : 7);
- //$page->setFont($font, $fontSize);
-
- $label = Mage::helper('sales')->__($total['title']) . ':';
-
- $lineBlock['lines'][] = array(
- array(
- 'text' => $label,
- 'feed' => 475,
- 'align' => 'right',
- 'font_size' => $fontSize,
- 'font' => 'bold'
- ),
- array(
- 'text' => $amount,
- 'feed' => 565,
- 'align' => 'right',
- 'font_size' => $fontSize,
- 'font' => 'bold'
- ),
- );
-
-// $page->drawText($label, 475-$this->widthForStringUsingFontSize($label, $font, $fontSize), $this->y, 'UTF-8');
-// $page->drawText($amount, 565-$this->widthForStringUsingFontSize($amount, $font, $fontSize), $this->y, 'UTF-8');
-// $this->y -=15;
}
}
-// echo '';
-// var_dump($lineBlock);
-
$page = $this->drawLineBlocks($page, array($lineBlock));
return $page;
}
diff --git a/app/code/core/Mage/Sales/Model/Order/Pdf/Total/Default.php b/app/code/core/Mage/Sales/Model/Order/Pdf/Total/Default.php
new file mode 100644
index 0000000000..e1e83597e0
--- /dev/null
+++ b/app/code/core/Mage/Sales/Model/Order/Pdf/Total/Default.php
@@ -0,0 +1,76 @@
+ array(
+ * 'amount' => $amount,
+ * 'label' => $label,
+ * 'font_size'=> $font_size
+ * )
+ * )
+ * @return array
+ */
+ public function getTotalsForDisplay()
+ {
+ $amount = $this->getOrder()->formatPriceTxt($this->getAmount());
+ if ($this->getAmountPrefix()) {
+ $amount = $this->getAmountPrefix().$amount;
+ }
+ $label = Mage::helper('sales')->__($this->getTitle()) . ':';
+ $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
+ $total = array(
+ 'amount' => $amount,
+ 'label' => $label,
+ 'font_size' => $fontSize
+ );
+ return array($total);
+ }
+
+ /**
+ * Check if we can display total information in PDF
+ *
+ * @return bool
+ */
+ public function canDisplay()
+ {
+ $amount = $this->getAmount();
+ return $this->getDisplayZero() || ($amount != 0);
+ }
+
+ /**
+ * Get Total amount from source
+ *
+ * @return float
+ */
+ public function getAmount()
+ {
+ return $this->getSource()->getDataUsingMethod($this->getSourceField());
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php
index 22db54aef4..767d61b48d 100644
--- a/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php
+++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Api.php
@@ -149,53 +149,27 @@ public function create($orderIncrementId, $itemsQty = array(), $comment = null,
$this->_fault('data_invalid', Mage::helper('sales')->__('Can not do shipment for order.'));
}
- $convertor = Mage::getModel('sales/convert_order');
- $shipment = $convertor->toShipment($order);
/* @var $shipment Mage_Sales_Model_Order_Shipment */
-
- foreach ($order->getAllItems() as $orderItem) {
- if (!$orderItem->getQtyToShip()) {
- continue;
- }
- if ($orderItem->getIsVirtual()) {
- continue;
- }
-
- if ((!isset($itemsQty[$orderItem->getId()])) && (count($itemsQty))) {
- continue;
- }
-
- $item = $convertor->itemToShipmentItem($orderItem);
- if (isset($itemsQty[$orderItem->getId()])) {
- $qty = $itemsQty[$orderItem->getId()];
+ $shipment = $order->prepareShipment($itemsQty);
+ if ($shipment) {
+ $shipment->register();
+ $shipment->addComment($comment, $email && $includeComment);
+ if ($email) {
+ $shipment->setEmailSent(true);
}
- else {
- $qty = $orderItem->getQtyToShip();
+ $shipment->getOrder()->setIsInProcess(true);
+ try {
+ $transactionSave = Mage::getModel('core/resource_transaction')
+ ->addObject($shipment)
+ ->addObject($shipment->getOrder())
+ ->save();
+ $shipment->sendEmail($email, ($includeComment ? $comment : ''));
+ } catch (Mage_Core_Exception $e) {
+ $this->_fault('data_invalid', $e->getMessage());
}
- $item->setQty($qty);
- $shipment->addItem($item);
- }
- $shipment->register();
- $shipment->addComment($comment, $email && $includeComment);
-
- if ($email) {
- $shipment->setEmailSent(true);
+ return $shipment->getIncrementId();
}
-
- $shipment->getOrder()->setIsInProcess(true);
-
- try {
- $transactionSave = Mage::getModel('core/resource_transaction')
- ->addObject($shipment)
- ->addObject($shipment->getOrder())
- ->save();
-
- $shipment->sendEmail($email, ($includeComment ? $comment : ''));
- } catch (Mage_Core_Exception $e) {
- $this->_fault('data_invalid', $e->getMessage());
- }
-
- return $shipment->getIncrementId();
+ return null;
}
/**
diff --git a/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php b/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php
index f935338d5f..a7a7eff646 100644
--- a/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php
+++ b/app/code/core/Mage/Sales/Model/Order/Shipment/Api/V2.php
@@ -128,48 +128,28 @@ public function create($orderIncrementId, $itemsQty = array(), $comment = null,
$this->_fault('data_invalid', Mage::helper('sales')->__('Can not do shipment for order.'));
}
- $convertor = Mage::getModel('sales/convert_order');
$shipment = $convertor->toShipment($order);
/* @var $shipment Mage_Sales_Model_Order_Shipment */
-
- foreach ($order->getAllItems() as $orderItem) {
- if (!$orderItem->getQtyToShip()) {
- continue;
- }
- if ($orderItem->getIsVirtual()) {
- continue;
- }
- $item = $convertor->itemToShipmentItem($orderItem);
- if (isset($itemsQty[$orderItem->getId()])) {
- $qty = $itemsQty[$orderItem->getId()];
+ $shipment = $order->prepareShipment($itemsQty);
+ if ($shipment) {
+ $shipment->register();
+ $shipment->addComment($comment, $email && $includeComment);
+ if ($email) {
+ $shipment->setEmailSent(true);
}
- else {
- $qty = $orderItem->getQtyToShip();
+ $shipment->getOrder()->setIsInProcess(true);
+ try {
+ $transactionSave = Mage::getModel('core/resource_transaction')
+ ->addObject($shipment)
+ ->addObject($shipment->getOrder())
+ ->save();
+ $shipment->sendEmail($email, ($includeComment ? $comment : ''));
+ } catch (Mage_Core_Exception $e) {
+ $this->_fault('data_invalid', $e->getMessage());
}
- $item->setQty($qty);
- $shipment->addItem($item);
- }
- $shipment->register();
- $shipment->addComment($comment, $email && $includeComment);
-
- if ($email) {
- $shipment->setEmailSent(true);
- }
-
- $shipment->getOrder()->setIsInProcess(true);
-
- try {
- $transactionSave = Mage::getModel('core/resource_transaction')
- ->addObject($shipment)
- ->addObject($shipment->getOrder())
- ->save();
-
- $shipment->sendEmail($email, ($includeComment ? $comment : ''));
- } catch (Mage_Core_Exception $e) {
- $this->_fault('data_invalid', $e->getMessage());
+ return $shipment->getIncrementId();
}
-
- return $shipment->getIncrementId();
+ return null;
}
/**
diff --git a/app/code/core/Mage/Sales/Model/Quote.php b/app/code/core/Mage/Sales/Model/Quote.php
index 6e1b433383..fd717ffee5 100644
--- a/app/code/core/Mage/Sales/Model/Quote.php
+++ b/app/code/core/Mage/Sales/Model/Quote.php
@@ -726,13 +726,18 @@ public function addProduct(Mage_Catalog_Model_Product $product, $request=null)
* @param Mage_Catalog_Model_Product $product
* @return Mage_Sales_Model_Quote_Item
*/
- protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty=1)
+ protected function _addCatalogProduct(Mage_Catalog_Model_Product $product, $qty = 1)
{
-
$item = $this->getItemByProduct($product);
if (!$item) {
$item = Mage::getModel('sales/quote_item');
$item->setQuote($this);
+ if (Mage::app()->getStore()->isAdmin()) {
+ $item->setStoreId($this->getStore()->getId());
+ }
+ else {
+ $item->setStoreId(Mage::app()->getStore()->getId());
+ }
}
/**
@@ -909,9 +914,6 @@ public function collectTotals()
$address->setSubtotal(0);
$address->setBaseSubtotal(0);
- $address->setSubtotalWithDiscount(0);
- $address->setBaseSubtotalWithDiscount(0);
-
$address->setGrandTotal(0);
$address->setBaseGrandTotal(0);
@@ -969,11 +971,20 @@ public function collectTotals()
/**
* Get all quote totals (sorted by priority)
+ * Metchod process quote states isVirtual and isMultiShipping
*
* @return array
*/
public function getTotals()
{
+ /**
+ * If quote is virtual we are using totals of billing address because
+ * all items assigned to it
+ */
+ if ($this->isVirtual()) {
+ return $this->getBillingAddress()->getTotals();
+ }
+
$totals = $this->getShippingAddress()->getTotals();
foreach ($this->getBillingAddress()->getTotals() as $code => $total) {
if (isset($totals[$code])) {
diff --git a/app/code/core/Mage/Sales/Model/Quote/Address.php b/app/code/core/Mage/Sales/Model/Quote/Address.php
index 6c617a6eb0..fc53b6d161 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Address.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Address.php
@@ -61,11 +61,11 @@ class Mage_Sales_Model_Quote_Address extends Mage_Customer_Model_Address_Abstrac
protected $_rates = null;
/**
- * Total models array
+ * Total models collector
*
- * @var array
+ * @var Mage_Sales_Model_Quote_Address_Totla_Collector
*/
- protected $_totalModels;
+ protected $_totalCollector = null;
/**
* Total data as array
@@ -74,6 +74,9 @@ class Mage_Sales_Model_Quote_Address extends Mage_Customer_Model_Address_Abstrac
*/
protected $_totals = array();
+ protected $_totalAmounts = array();
+ protected $_baseTotalAmounts = array();
+
/**
* Initialize resource
*/
@@ -240,7 +243,8 @@ public function getAllItems()
}
if (!$aItem->getQuoteItemImported()) {
- if ($qItem = $this->getQuote()->getItemById($aItem->getQuoteItemId())) {
+ $qItem = $this->getQuote()->getItemById($aItem->getQuoteItemId());
+ if ($qItem) {
$this->addItem($aItem);
$aItem->importQuoteItem($qItem);
}
@@ -253,12 +257,7 @@ public function getAllItems()
if ($qItem->isDeleted()) {
continue;
}
-// if ($this->getAddressType() == self::TYPE_BILLING && $qItem->getProduct()->getIsVirtual()) {
-// $items[] = $qItem;
-// }
-// elseif ($this->getAddressType() == self::TYPE_SHIPPING && !$qItem->getProduct()->getIsVirtual()) {
-// $items[] = $qItem;
-// }
+
/**
* For virtual quote we assign all items to billing address
*/
@@ -312,7 +311,8 @@ public function getItemQty($itemId = 0)
$qty += $item->getQty();
}
} else {
- if ($item = $this->getItemById($itemId)) {
+ $item = $this->getItemById($itemId);
+ if ($item) {
$qty = $item->getQty();
}
}
@@ -369,7 +369,8 @@ public function getItemByQuoteItemId($itemId)
*/
public function removeItem($itemId)
{
- if ($item = $this->getItemById($itemId)) {
+ $item = $this->getItemById($itemId);
+ if ($item) {
$item->isDeleted(true);
}
return $this;
@@ -567,7 +568,9 @@ public function collectShippingRates()
$this->removeAllShippingRates();
- if (!$this->getCountryId() && !$this->getPostcode()) {
+ $havingOptionalZip = Mage::helper('directory')->getCountriesWithOptionalZip();
+ $postcodeValid = $this->getPostcode() || in_array($this->getCountryId(), $havingOptionalZip);
+ if (!$this->getCountryId() && !$postcodeValid) {
return $this;
}
@@ -636,30 +639,31 @@ public function collectShippingRates()
return $this;
}
+ /**
+ * Get totals collector model
+ *
+ * @return Mage_Sales_Model_Quote_Address_Total_Collector
+ */
+ public function getTotalCollector()
+ {
+ if ($this->_totalCollector === null) {
+ $this->_totalCollector = Mage::getSingleton(
+ 'sales/quote_address_total_collector',
+ array('store'=>$this->getQuote()->getStore())
+ );
+ }
+ return $this->_totalCollector;
+ }
+
/**
* Retrieve total models
*
+ * @deprecated
* @return array
*/
public function getTotalModels()
{
- if (!$this->_totalModels) {
- $totalsConfig = Mage::getConfig()->getNode('global/sales/quote/totals');
- $models = array();
- foreach ($totalsConfig->children() as $totalCode=>$totalConfig) {
- $sort = Mage::getStoreConfig('sales/totals_sort/'.$totalCode);
- while (isset($models[$sort])) {
- $sort++;
- }
- $class = $totalConfig->getClassName();
- if ($class && ($model = Mage::getModel($class))) {
- $models[$sort] = $model->setCode($totalCode);
- }
- }
- ksort($models);
- $this->_totalModels = $models;
- }
- return $this->_totalModels;
+ return $this->getTotalCollector()->getRetrievers();
}
/**
@@ -669,25 +673,21 @@ public function getTotalModels()
*/
public function collectTotals()
{
- foreach ($this->getTotalModels() as $model) {
- if (is_callable(array($model, 'collect'))) {
- $model->collect($this);
- }
+ foreach ($this->getTotalCollector()->getCollectors() as $model) {
+ $model->collect($this);
}
return $this;
}
/**
- * Retrieve totals as array
+ * Get address totals as array
*
* @return array
*/
public function getTotals()
{
- foreach ($this->getTotalModels() as $model) {
- if (is_callable(array($model, 'fetch'))) {
- $model->fetch($this);
- }
+ foreach ($this->getTotalCollector()->getRetrievers() as $model) {
+ $model->fetch($this);
}
return $this->_totals;
}
@@ -706,6 +706,7 @@ public function addTotal($total)
} elseif ($total instanceof Mage_Sales_Model_Quote_Total) {
$totalInstance = $total;
}
+ $totalInstance->setAddress($this);
$this->_totals[$totalInstance->getCode()] = $totalInstance;
return $this;
}
@@ -776,14 +777,16 @@ public function setAppliedTaxes($data)
*/
public function setShippingAmount($value, $alreadyExclTax = false)
{
- if (Mage::helper('tax')->shippingPriceIncludesTax()) {
- $includingTax = Mage::helper('tax')->getShippingPrice($value, true, $this, $this->getQuote()->getCustomerTaxClassId());
- if (!$alreadyExclTax) {
- $value = Mage::helper('tax')->getShippingPrice($value, false, $this, $this->getQuote()->getCustomerTaxClassId());
- }
- $this->setShippingTaxAmount($includingTax - $value);
- }
return $this->setData('shipping_amount', $value);
+//
+// if (Mage::helper('tax')->shippingPriceIncludesTax()) {
+// $includingTax = Mage::helper('tax')->getShippingPrice($value, true, $this, $this->getQuote()->getCustomerTaxClassId());
+// if (!$alreadyExclTax) {
+// $value = Mage::helper('tax')->getShippingPrice($value, false, $this, $this->getQuote()->getCustomerTaxClassId());
+// }
+// $this->setShippingTaxAmount($includingTax - $value);
+// }
+// return $this->setData('shipping_amount', $value);
}
/**
@@ -795,13 +798,117 @@ public function setShippingAmount($value, $alreadyExclTax = false)
*/
public function setBaseShippingAmount($value, $alreadyExclTax = false)
{
- if (Mage::helper('tax')->shippingPriceIncludesTax()) {
- $includingTax = Mage::helper('tax')->getShippingPrice($value, true, $this, $this->getQuote()->getCustomerTaxClassId());
- if (!$alreadyExclTax) {
- $value = Mage::helper('tax')->getShippingPrice($value, false, $this, $this->getQuote()->getCustomerTaxClassId());
- }
- $this->setBaseShippingTaxAmount($includingTax - $value);
- }
return $this->setData('base_shipping_amount', $value);
+//
+// if (Mage::helper('tax')->shippingPriceIncludesTax()) {
+// $includingTax = Mage::helper('tax')->getShippingPrice($value, true, $this, $this->getQuote()->getCustomerTaxClassId());
+// if (!$alreadyExclTax) {
+// $value = Mage::helper('tax')->getShippingPrice($value, false, $this, $this->getQuote()->getCustomerTaxClassId());
+// }
+// $this->setBaseShippingTaxAmount($includingTax - $value);
+// }
+// return $this->setData('base_shipping_amount', $value);
+ }
+
+ /**
+ * Set total amount value
+ *
+ * @param string $code
+ * @param float $amount
+ * @return Mage_Sales_Model_Quote_Address
+ */
+ public function setTotalAmount($code, $amount)
+ {
+ $this->_totalAmounts[$code] = $amount;
+ if ($code != 'subtotal') {
+ $code = $code.'_amount';
+ }
+ $this->setData($code, $amount);
+ return $this;
+ }
+
+ /**
+ * Set total amount value in base store currency
+ *
+ * @param string $code
+ * @param float $amount
+ * @return Mage_Sales_Model_Quote_Address
+ */
+ public function setBaseTotalAmount($code, $amount)
+ {
+ $this->_baseTotalAmounts[$code] = $amount;
+ if ($code != 'subtotal') {
+ $code = $code.'_amount';
+ }
+ $this->setData('base_'.$code, $amount);
+ return $this;
+ }
+
+ /**
+ * Get total amount value by code
+ *
+ * @param string $code
+ * @return float
+ */
+ public function getTotalAmount($code)
+ {
+ if (isset($this->_totalAmounts[$code])) {
+ return $this->_totalAmounts[$code];
+ }
+ return 0;
+ }
+
+ /**
+ * Get total amount value by code in base store curncy
+ *
+ * @param string $code
+ * @return float
+ */
+ public function getBaseTotalAmount($code)
+ {
+ if (isset($this->_baseTotalAmounts[$code])) {
+ return $this->_baseTotalAmounts[$code];
+ }
+ return 0;
+ }
+
+ /**
+ * Get all total amount values
+ *
+ * @return array
+ */
+ public function getAllTotalAmounts()
+ {
+ return $this->_totalAmounts;
+ }
+
+ /**
+ * Get all total amount values in base currency
+ *
+ * @return array
+ */
+ public function getAllBaseTotalAmounts()
+ {
+ return $this->_baseTotalAmounts;
+ }
+
+ /**
+ * Get subtotal amount with applied discount in base currency
+ *
+ * @return float
+ */
+ public function getBaseSubtotalWithDiscount()
+ {
+ return $this->getBaseSubtotal()-$this->getBaseDiscountAmount();
+ }
+
+ /**
+ * Get subtotal amount with applied discount
+ *
+ * @return float
+ */
+ public function getSubtotalWithDiscount()
+ {
+ return $this->getSubtotal()-$this->getDiscountAmount();
}
}
diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Abstract.php
index bf23aebc8d..7336a398a2 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Abstract.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Abstract.php
@@ -40,6 +40,7 @@ abstract class Mage_Sales_Model_Quote_Address_Total_Abstract
* @var string
*/
protected $_code;
+ protected $_address = null;
/**
* Set total code code name
@@ -64,13 +65,19 @@ public function getCode()
}
/**
- * Collect totals process
+ * Collect totals process.
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Abstract
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
+ $this->_setAddress($address);
+ /**
+ * Reset amounts
+ */
+ $this->_setAmount(0);
+ $this->_setBaseAmount(0);
return $this;
}
@@ -82,6 +89,102 @@ public function collect(Mage_Sales_Model_Quote_Address $address)
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
+ $this->_setAddress($address);
return array();
}
+
+ /**
+ * Set address shich can be used inside totals calculation
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
+ */
+ protected function _setAddress(Mage_Sales_Model_Quote_Address $address)
+ {
+ $this->_address = $address;
+ return $this;
+ }
+
+ /**
+ * Get quote address object
+ *
+ * @throw Mage_Core_Exception if address not declared
+ * @return Mage_Sales_Model_Quote_Address
+ */
+ protected function _getAddress()
+ {
+ if ($this->_address === null) {
+ Mage::throwException(
+ Mage::helper('sales')->__('Address model is not defined')
+ );
+ }
+ return $this->_address;
+ }
+
+ /**
+ * Set total model amount value to address
+ *
+ * @param float $amount
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
+ */
+ protected function _setAmount($amount)
+ {
+ $this->_getAddress()->setTotalAmount($this->getCode(), $amount);
+ return $this;
+ }
+
+ /**
+ * Set total model base amount value to address
+ *
+ * @param float $amount
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
+ */
+ protected function _setBaseAmount($baseAmount)
+ {
+ $this->_getAddress()->setBaseTotalAmount($this->getCode(), $baseAmount);
+ return $this;
+ }
+
+ /**
+ * Add total model amount value to address
+ *
+ * @param float $amount
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
+ */
+ protected function _addAmount($amount)
+ {
+ $this->_getAddress()->setTotalAmount(
+ $this->getCode(),
+ $this->_getAddress()->getTotalAmount($this->getCode())+$amount
+ );
+ return $this;
+ }
+
+ /**
+ * Add total model base amount value to address
+ *
+ * @param float $amount
+ * @return Mage_Sales_Model_Quote_Address_Total_Abstract
+ */
+ protected function _addBaseAmount($baseAmount)
+ {
+ $this->_getAddress()->setBaseTotalAmount(
+ $this->getCode(),
+ $this->_getAddress()->getBaseTotalAmount($this->getCode())+$baseAmount
+ );
+ return $this;
+ }
+
+ /**
+ * Process model configuration array.
+ * This method can be used for changing models apply sort order
+ *
+ * @param array $config
+ * @param store $store
+ * @return array
+ */
+ public function processConfigArray($config, $store)
+ {
+ return $config;
+ }
}
diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php
new file mode 100644
index 0000000000..fadebe8a95
--- /dev/null
+++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Collector.php
@@ -0,0 +1,230 @@
+_store = $options['store'];
+ } else {
+ $this->_store = Mage::app()->getStore();
+ }
+ $this->_initModels()
+ ->_initCollectors()
+ ->_initRetrievers();
+ }
+
+ /**
+ * Get total models array ordered for right calculation logic
+ *
+ * @return array
+ */
+ public function getCollectors()
+ {
+ return $this->_collectors;
+ }
+
+ /**
+ * Get total models array ordered for right display sequence
+ *
+ * @return array
+ */
+ public function getRetrievers()
+ {
+ return $this->_retrievers;
+ }
+
+ /**
+ * Initialize total models configuration and objects
+ *
+ * @return Mage_Sales_Model_Quote_Address_Total_Collector
+ */
+ protected function _initModels()
+ {
+ $totalsConfig = Mage::getConfig()->getNode('global/sales/quote/totals');
+
+ foreach ($totalsConfig->children() as $totalCode=>$totalConfig) {
+ $class = $totalConfig->getClassName();
+ if ($class) {
+ $model = Mage::getModel($class);
+ if ($model instanceof Mage_Sales_Model_Quote_Address_Total_Abstract) {
+ $model->setCode($totalCode);
+ $this->_modelsConfig[$totalCode]= $this->_prepareConfigArray($totalCode, $totalConfig);
+ $this->_modelsConfig[$totalCode]= $model->processConfigArray(
+ $this->_modelsConfig[$totalCode],
+ $this->_store
+ );
+ $this->_models[$totalCode] = $model;
+ } else {
+ Mage::throwException(
+ Mage::helper('sales')->__('Address total model should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract')
+ );
+ }
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Prepare configuration array for total model
+ *
+ * @param string $code
+ * @param Mage_Core_Model_Config_Element $totalConfig
+ * @return array
+ */
+ protected function _prepareConfigArray($code, $totalConfig)
+ {
+ $totalConfig = (array) $totalConfig;
+ if (isset($totalConfig['before'])) {
+ $totalConfig['before'] = explode(',',$totalConfig['before']);
+ } else {
+ $totalConfig['before'] = array();
+ }
+ if (isset($totalConfig['after'])) {
+ $totalConfig['after'] = explode(',',$totalConfig['after']);
+ } else {
+ $totalConfig['after'] = array();
+ }
+ $totalConfig['_code'] = $code;
+ return $totalConfig;
+ }
+
+ /**
+ * Aggregate before/after information from all items and sort totals based on this data
+ *
+ * @return array
+ */
+ protected function _getSortedCollectorCodes()
+ {
+ if (Mage::app()->useCache('config')) {
+ $cachedData = Mage::app()->loadCache('sorted_quote_collectors');
+ if ($cachedData) {
+ return unserialize($cachedData);
+ }
+ }
+ $configArray = $this->_modelsConfig;
+ foreach ($configArray as $code => $data) {
+ foreach ($data['before'] as $beforeCode) {
+ if (!isset($configArray[$beforeCode])) {
+ continue;
+ }
+ $configArray[$code]['before'] = array_merge(
+ $configArray[$code]['before'], $configArray[$beforeCode]['before']
+ );
+ $configArray[$beforeCode]['after'] = array_merge(
+ $configArray[$beforeCode]['after'], array($code), $data['after']
+ );
+ $configArray[$beforeCode]['after'] = array_unique($configArray[$beforeCode]['after']);
+ }
+ foreach ($data['after'] as $afterCode) {
+ if (!isset($configArray[$afterCode])) {
+ continue;
+ }
+ $configArray[$code]['after'] = array_merge(
+ $configArray[$code]['after'], $configArray[$afterCode]['after']
+ );
+ $configArray[$afterCode]['before'] = array_merge(
+ $configArray[$afterCode]['before'], array($code), $data['before']
+ );
+ $configArray[$afterCode]['before'] = array_unique($configArray[$afterCode]['before']);
+ }
+ }
+ uasort($configArray, array($this, '_compareTotals'));
+ $sortedCollectors = array_keys($configArray);
+ if (Mage::app()->useCache('config')) {
+ Mage::app()->saveCache(serialize($sortedCollectors), 'sorted_quote_collectors', array(
+ Mage_Core_Model_Config::CACHE_TAG
+ ));
+ }
+ return $sortedCollectors;
+ }
+
+ /**
+ * Initialize collectors array.
+ * Collectors array is array of total models ordered based on configuration settings
+ *
+ * @return Mage_Sales_Model_Quote_Address_Total_Collector
+ */
+ protected function _initCollectors()
+ {
+ $sortedCodes = $this->_getSortedCollectorCodes();
+ foreach ($sortedCodes as $code) {
+ $this->_collectors[$code] = $this->_models[$code];
+ }
+
+ return $this;
+ }
+
+ /**
+ * uasort callback function
+ *
+ * @param array $a
+ * @param array $b
+ * @return int
+ */
+ protected function _compareTotals($a, $b)
+ {
+ $aCode = $a['_code'];
+ $bCode = $b['_code'];
+ if (in_array($aCode, $b['after']) || in_array($bCode, $a['before'])) {
+ $res = -1;
+ } elseif (in_array($bCode, $a['after']) || in_array($aCode, $b['before'])) {
+ $res = 1;
+ } else {
+ $res = 0;
+ }
+ return $res;
+ }
+
+ /**
+ * Initialize retrievers array
+ *
+ * @return Mage_Sales_Model_Quote_Address_Total_Collector
+ */
+ protected function _initRetrievers()
+ {
+ $sorts = Mage::getStoreConfig('sales/totals_sort', $this->_store);
+ foreach ($sorts as $code => $sortOrder) {
+ if (isset($this->_models[$code])) {
+ $this->_retrievers[$sortOrder] = $this->_models[$code];
+ }
+ }
+ ksort($this->_retrievers);
+ $notSorted = array_diff(array_keys($this->_models), array_keys($sorts));
+ foreach ($notSorted as $code) {
+ $this->_retrievers[] = $this->_models[$code];
+ }
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php
index f961e0a176..9f620f6400 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Discount.php
@@ -20,6 +20,8 @@
*
* @category Mage
* @package Mage_Sales
+ * @deprecated Moved to SalesRule Module
+ * @deprecated after 1.3.2.2, functionality moved to salesRule module
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Grand.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Grand.php
index 0b893c222a..515c9d7462 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Grand.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Grand.php
@@ -27,13 +27,38 @@
class Mage_Sales_Model_Quote_Address_Total_Grand extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
+ /**
+ * Collect grand total address amount
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Sales_Model_Quote_Address_Total_Grand
+ */
+ public function collect(Mage_Sales_Model_Quote_Address $address)
+ {
+ $grandTotal = $address->getGrandTotal();
+ $baseGrandTotal = $address->getBaseGrandTotal();
+
+ $totals = array_sum($address->getAllTotalAmounts());
+ $baseTotals = array_sum($address->getAllBaseTotalAmounts());
+
+ $address->setGrandTotal($grandTotal+$totals);
+ $address->setBaseGrandTotal($baseGrandTotal+$baseTotals);
+ return $this;
+ }
+
+ /**
+ * Add grand total information to adderess
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Sales_Model_Quote_Address_Total_Grand
+ */
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$address->addTotal(array(
- 'code'=>$this->getCode(),
- 'title'=>Mage::helper('sales')->__('Grand Total'),
- 'value'=>$address->getGrandTotal(),
- 'area'=>'footer',
+ 'code' => $this->getCode(),
+ 'title' => Mage::helper('sales')->__('Grand Total'),
+ 'value' => $address->getGrandTotal(),
+ 'area' => 'footer',
));
return $this;
}
diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php
index 17eba71195..622358db48 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php
@@ -27,21 +27,34 @@
class Mage_Sales_Model_Quote_Address_Total_Shipping extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
+ public function __construct()
+ {
+ $this->setCode('shipping');
+ }
+
+ /**
+ * Collect totals information about shipping
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Sales_Model_Quote_Address_Total_Shipping
+ */
public function collect(Mage_Sales_Model_Quote_Address $address)
{
+ parent::collect($address);
+
$oldWeight = $address->getWeight();
$address->setWeight(0);
- $address->setShippingAmount(0);
- $address->setBaseShippingAmount(0);
$address->setFreeMethodWeight(0);
+ $this->_setAmount(0)
+ ->_setBaseAmount(0);
$items = $address->getAllItems();
if (!count($items)) {
return $this;
}
- $method = $address->getShippingMethod();
- $freeAddress = $address->getFreeShipping();
+ $method = $address->getShippingMethod();
+ $freeAddress= $address->getFreeShipping();
$addressWeight = $address->getWeight();
$freeMethodWeight = $address->getFreeMethodWeight();
@@ -52,10 +65,10 @@ public function collect(Mage_Sales_Model_Quote_Address $address)
/**
* Skip if this item is virtual
*/
-
if ($item->getProduct()->isVirtual()) {
continue;
}
+
/**
* Children weight we calculate for parent
*/
@@ -68,11 +81,11 @@ public function collect(Mage_Sales_Model_Quote_Address $address)
if ($child->getProduct()->isVirtual()) {
continue;
}
- $addressQty += $item->getQty()*$child->getQty();
+ $addressQty += $child->getTotalQty();
if (!$item->getProduct()->getWeightType()) {
$itemWeight = $child->getWeight();
- $itemQty = $item->getQty()*$child->getQty();
+ $itemQty = $child->getTotalQty();
$rowWeight = $itemWeight*$itemQty;
$addressWeight += $rowWeight;
if ($freeAddress || $child->getFreeShipping()===true) {
@@ -141,8 +154,8 @@ public function collect(Mage_Sales_Model_Quote_Address $address)
$address->collectShippingRates();
- $address->setShippingAmount(0);
- $address->setBaseShippingAmount(0);
+ $this->_setAmount(0)
+ ->_setBaseAmount(0);
$method = $address->getShippingMethod();
@@ -150,19 +163,23 @@ public function collect(Mage_Sales_Model_Quote_Address $address)
foreach ($address->getAllShippingRates() as $rate) {
if ($rate->getCode()==$method) {
$amountPrice = $address->getQuote()->getStore()->convertPrice($rate->getPrice(), false);
- $address->setShippingAmount($amountPrice);
- $address->setBaseShippingAmount($rate->getPrice());
+ $this->_setAmount($amountPrice);
+ $this->_setBaseAmount($rate->getPrice());
$address->setShippingDescription($rate->getCarrierTitle().' - '.$rate->getMethodTitle());
break;
}
}
}
- $address->setGrandTotal($address->getGrandTotal() + $address->getShippingAmount());
- $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseShippingAmount());
return $this;
}
+ /**
+ * Add shipping totals information to address object
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Sales_Model_Quote_Address_Total_Shipping
+ */
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$amount = $address->getShippingAmount();
diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php
index 4d8c0a392f..ad4ff6e3a7 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Subtotal.php
@@ -35,13 +35,8 @@ class Mage_Sales_Model_Quote_Address_Total_Subtotal extends Mage_Sales_Model_Quo
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
- /**
- * Reset subtotal information
- */
- $address->setSubtotal(0);
- $address->setBaseSubtotal(0);
+ parent::collect($address);
$address->setTotalQty(0);
- $address->setBaseTotalPriceIncTax(0);
/**
* Process address items
@@ -57,8 +52,6 @@ public function collect(Mage_Sales_Model_Quote_Address $address)
/**
* Initialize grand totals
*/
- $address->setGrandTotal($address->getSubtotal());
- $address->setBaseGrandTotal($address->getBaseSubtotal());
Mage::helper('sales')->checkQuoteAmount($address->getQuote(), $address->getSubtotal());
Mage::helper('sales')->checkQuoteAmount($address->getQuote(), $address->getBaseSubtotal());
return $this;
@@ -104,13 +97,12 @@ protected function _initItem($address, $item)
);
$item->setPrice($finalPrice);
$item->calcRowTotal();
- }
- else if (!$quoteItem->getParentItem()) {
+ } else if (!$quoteItem->getParentItem()) {
$finalPrice = $product->getFinalPrice($quoteItem->getQty());
$item->setPrice($finalPrice);
$item->calcRowTotal();
- $address->setSubtotal($address->getSubtotal() + $item->getRowTotal());
- $address->setBaseSubtotal($address->getBaseSubtotal() + $item->getBaseRowTotal());
+ $this->_addAmount($item->getRowTotal());
+ $this->_addBaseAmount($item->getBaseRowTotal());
$address->setTotalQty($address->getTotalQty() + $item->getQty());
}
@@ -142,12 +134,18 @@ protected function _removeItem($address, $item)
return $this;
}
+ /**
+ * Assign subtotal amount and label to address object
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Sales_Model_Quote_Address_Total_Subtotal
+ */
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$address->addTotal(array(
- 'code'=>$this->getCode(),
- 'title'=>Mage::helper('sales')->__('Subtotal'),
- 'value'=>$address->getSubtotal()
+ 'code' => $this->getCode(),
+ 'title' => Mage::helper('sales')->__('Subtotal'),
+ 'value' => $address->getSubtotal()
));
return $this;
}
diff --git a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Tax.php b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Tax.php
index 69a4027ce1..37325ba362 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Address/Total/Tax.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Address/Total/Tax.php
@@ -20,6 +20,7 @@
*
* @category Mage
* @package Mage_Sales
+ * @deprecated after 1.3.2.2, functionality moved to tax module
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
index 1e9d524c78..f59dc2d213 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php
@@ -44,6 +44,11 @@ abstract class Mage_Sales_Model_Quote_Item_Abstract extends Mage_Core_Model_Abst
*/
abstract function getQuote();
+ /**
+ * Specify parent item id before saving data
+ *
+ * @return Mage_Sales_Model_Quote_Item_Abstract
+ */
protected function _beforeSave()
{
parent::_beforeSave();
@@ -121,8 +126,8 @@ public function setMessage($messages) {
/**
* Add message of quote item to array of messages
*
- * @param string $message
- * @return Mage_Sales_Model_Quote_Item_Abstract
+ * @param string $message
+ * @return Mage_Sales_Model_Quote_Item_Abstract
*/
public function addMessage($message)
{
@@ -133,7 +138,8 @@ public function addMessage($message)
/**
* Get messages array of quote item
*
- * @return array
+ * @param bool $string flag for converting messages to string
+ * @return array | string
*/
public function getMessage($string = true)
{
@@ -163,15 +169,14 @@ public function checkData()
$this->setHasError(false);
$this->unsMessage();
- $qty = $this->getData('qty');
+ $qty = $this->_getData('qty');
+
try {
$this->setQty($qty);
- }
- catch (Mage_Core_Exception $e){
+ } catch (Mage_Core_Exception $e){
$this->setHasError(true);
$this->setMessage($e->getMessage());
- }
- catch (Exception $e){
+ } catch (Exception $e){
$this->setHasError(true);
$this->setMessage(Mage::helper('sales')->__('Item qty declare error'));
}
@@ -182,7 +187,9 @@ public function checkData()
$this->setHasError(true);
$this->setMessage($e->getMessage());
$this->getQuote()->setHasError(true);
- $this->getQuote()->addMessage(Mage::helper('sales')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.'));
+ $this->getQuote()->addMessage(
+ Mage::helper('sales')->__('Some of the products below don\'t have all the required options. Please remove them and add again with all the required options.')
+ );
} catch (Exception $e) {
$this->setHasError(true);
$this->setMessage(Mage::helper('sales')->__('Item options declare error'));
@@ -193,6 +200,29 @@ public function checkData()
return $this;
}
+ /**
+ * Get original (not related with parent item) item quantity
+ *
+ * @return int|float
+ */
+ public function getQty()
+ {
+ return $this->_getData('qty');
+ }
+
+ /**
+ * Get total item quantity (include parent item relation)
+ *
+ * @return int|float
+ */
+ public function getTotalQty()
+ {
+ if ($this->getParentItem()) {
+ return $this->getQty()*$this->getParentItem()->getQty();
+ }
+ return $this->getQty();
+ }
+
/**
* Calculate item row total price
*
@@ -200,31 +230,207 @@ public function checkData()
*/
public function calcRowTotal()
{
- $qty = $this->getQty();
+ $qty = $this->getTotalQty();
+ $total = $this->getCalculationPrice()*$qty;
+ $baseTotal = $this->getBaseCalculationPrice()*$qty;
- if ($this->getParentItem()) {
- $qty = $qty*$this->getParentItem()->getQty();
+ $this->setRowTotal($this->getStore()->roundPrice($total));
+ $this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
+ return $this;
+ }
+
+ /**
+ * Get item price used for quote calculation process.
+ * This method get custom price (if ut defined) or original product final price
+ *
+ * @return float
+ */
+ public function getCalculationPrice()
+ {
+ $price = $this->_getData('calculation_price');
+ if (is_null($price)) {
+ if ($this->hasCustomPrice()) {
+ $price = $this->getCustomPrice();
+ }
+ else {
+ $price = $this->getOriginalPrice();
+ }
+ $this->setData('calculation_price', $price);
}
+ return $price;
+ }
- if ($rowTotal = $this->getRowTotalExcTax()) {
- $baseTotal = $rowTotal;
- $total = $this->getStore()->convertPrice($baseTotal);
+ /**
+ * Get calculation price used for quote calculation in base currency.
+ *
+ * @return float
+ */
+ public function getBaseCalculationPrice()
+ {
+ if (!$this->hasBaseCalculationPrice()) {
+ if ($this->hasCustomPrice()) {
+ $price = (float) $this->getCustomPrice();
+ if ($price) {
+ $rate = $this->getStore()->convertPrice($price) / $price;
+ $price = $price / $rate;
+ }
+ } else {
+ $price = $this->getPrice();
+ }
+ $this->setBaseCalculationPrice($price);
}
- else {
- $total = $this->getCalculationPrice()*$qty;
- $baseTotal = $this->getBaseCalculationPrice()*$qty;
+ return $this->_getData('base_calculation_price');
+ }
+
+ /**
+ * Get original price (retrieved from product) for item.
+ * Original price value is in current selected currency
+ *
+ * @return float
+ */
+ public function getOriginalPrice()
+ {
+ $price = $this->_getData('original_price');
+ if (is_null($price)) {
+ $price = $this->getStore()->convertPrice($this->getPrice());
+ $this->setData('original_price', $price);
}
+ return $price;
+ }
- $this->setRowTotal($this->getStore()->roundPrice($total));
- $this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
+ /**
+ * Set original price to item (calculation price will be refreshed too)
+ *
+ * @param float $price
+ * @return Mage_Sales_Model_Quote_Item_Abstract
+ */
+ public function setOriginalPrice($price)
+ {
+ $this->setCalculationPrice(null);
+ return $this->setData('original_price', $price);
+ }
+
+ /**
+ * Get Original item price (got from product) in base website currency
+ *
+ * @return float
+ */
+ public function getBaseOriginalPrice()
+ {
+ return $this->getPrice();
+ }
+
+ /**
+ * Get item price (item price always exclude price)
+ *
+ * @return decimal
+ */
+ public function getPrice()
+ {
+ return $this->_getData('price');
+ }
+ /**
+ * Specify custom item price (used in case whe we have apply not product price to item)
+ *
+ * @param float $value
+ * @return Mage_Sales_Model_Quote_Item_Abstract
+ */
+ public function setCustomPrice($value)
+ {
+ return $this->setData('custom_price', $value);
+ }
+
+ /**
+ * Specify item price (base calculation price will be refreshed too)
+ *
+ * @param float $value
+ * @return Mage_Sales_Model_Quote_Item_Abstract
+ */
+ public function setPrice($value)
+ {
+ $this->setBaseCalculationPrice(null);
+ return $this->setData('price', $value);
+ }
+
+ /**
+ * Clone quote item
+ *
+ * @return Mage_Sales_Model_Quote_Item
+ */
+ public function __clone()
+ {
+ $this->setId(null);
+ $this->_parentItem = null;
+ $this->_children = array();
+ $this->_messages = array();
return $this;
}
+
+ /**
+ * Checking if there children calculated or parent item
+ * when we have parent quote item and its children
+ *
+ * @return bool
+ */
+ public function isChildrenCalculated() {
+ if ($this->getParentItem()) {
+ $calculate = $this->getParentItem()->getProduct()->getPriceType();
+ } else {
+ $calculate = $this->getProduct()->getPriceType();
+ }
+
+ if ((null !== $calculate) && (int)$calculate === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
+ return true;
+ }
+ return false;
+ }
+
+
+ /**
+ * Checking can we ship product separatelly (each child separately)
+ * or each parent product item can be shipped only like one item
+ *
+ * @return bool
+ */
+ public function isShipSeparately() {
+ if ($this->getParentItem()) {
+ $shipmentType = $this->getParentItem()->getProduct()->getShipmentType();
+ } else {
+ $shipmentType = $this->getProduct()->getShipmentType();
+ }
+
+ if ((null !== $shipmentType) && (int)$shipmentType === Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
+ return true;
+ }
+ return false;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/**
* Calculate item tax amount
*
- * @return Mage_Sales_Model_Quote_Item
+ * @deprecated logic moved to tax totals calculation model
+ * @return Mage_Sales_Model_Quote_Item
*/
public function calcTaxAmount()
{
@@ -279,72 +485,16 @@ public function calcTaxAmount()
return $this;
}
- /**
- * Retrieve item price used for calculation
- *
- * @return unknown
- */
- public function getCalculationPrice()
- {
- $price = $this->getData('calculation_price');
- if (is_null($price)) {
- if ($this->hasCustomPrice()) {
- $price = $this->getCustomPrice();
- }
- else {
- $price = $this->getOriginalPrice();
- }
- $this->setData('calculation_price', $price);
- }
- return $price;
- }
-
- /**
- * Retrieve calculation price in base currency
- *
- * @return unknown
- */
- public function getBaseCalculationPrice()
- {
- if (!$this->hasBaseCalculationPrice()) {
- if ($this->hasCustomPrice()) {
- if ($price = (float) $this->getCustomPrice()) {
- $rate = $this->getStore()->convertPrice($price) / $price;
- $price = $price / $rate;
- }
- else {
- $price = $this->getCustomPrice();
- }
- } else {
- $price = $this->getPrice();
- }
- $this->setBaseCalculationPrice($price);
- }
- return $this->getData('base_calculation_price');
- }
-
- /**
- * Retrieve original price (retrieved from product) for item
- *
- * @return float
- */
- public function getOriginalPrice()
- {
- $price = $this->getData('original_price');
- if (is_null($price)) {
- $price = $this->getStore()->convertPrice($this->getPrice());
- $this->setData('original_price', $price);
- }
- return $price;
- }
-
/**
* Get item tax amount
*
- * @return decimal
+ * @deprecated
+ * @return decimal
*/
public function getTaxAmount()
{
+ return $this->_getData('tax_amount');
+
$priceType = $this->getProduct()->getPriceType();
if ($this->getHasChildren() && (null !== $priceType) && (int)$priceType === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
$amount = 0;
@@ -358,13 +508,17 @@ public function getTaxAmount()
}
}
+
/**
* Get item base tax amount
*
+ * @deprecated
* @return decimal
*/
public function getBaseTaxAmount()
{
+ return $this->_getData('base_tax_amount');
+
$priceType = $this->getProduct()->getPriceType();
if ($this->getHasChildren() && (null !== $priceType) && (int)$priceType === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
$baseAmount = 0;
@@ -381,45 +535,9 @@ public function getBaseTaxAmount()
/**
* Get item price (item price always exclude price)
*
+ * @deprecated
* @return decimal
*/
- public function getPrice()
- {
- $priceType = $this->getProduct()->getPriceType();
- if ($this->getHasChildren() && (null !== $priceType) && (int)$priceType === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
- $price = $this->_getData('price');
- /*
- foreach ($this->getChildren() as $child) {
- $price+= $child->getPrice()*$child->getQty();
- }
- */
- return $price;
- }
- else {
- return $this->_getData('price');
- }
- }
-
- public function setCustomPrice($value)
- {
- if (is_null($value)) {
- return $this->setData('custom_price', $value);
- }
-
- $excludingTax = $this->_calculatePrice($value, Mage::helper('tax')->applyTaxOnCustomPrice());
- $this->setData('original_custom_price', $value);
- return $this->setData('custom_price', $excludingTax);
- }
-
- public function setPrice($value)
- {
- $saveTaxes = true;
- if (Mage::helper('tax')->applyTaxOnCustomPrice() && $this->hasCustomPrice()) {
- $saveTaxes = false;
- }
- return $this->setData('price', $this->_calculatePrice($value, $saveTaxes));
- }
-
protected function _calculatePrice($value, $saveTaxes = true)
{
$store = $this->getQuote()->getStore();
@@ -513,56 +631,4 @@ protected function _calculatePrice($value, $saveTaxes = true)
return $value;
}
-
- /**
- * Clone quote item
- *
- * @return Mage_Sales_Model_Quote_Item
- */
- public function __clone()
- {
- $this->setId(null);
- $this->_parentItem = null;
- $this->_children = array();
- return $this;
- }
-
- /**
- * Checking if there children calculated or parent item
- * when we have parent quote item and its children
- *
- * @return bool
- */
- public function isChildrenCalculated() {
- if ($this->getParentItem()) {
- $calculate = $this->getParentItem()->getProduct()->getPriceType();
- } else {
- $calculate = $this->getProduct()->getPriceType();
- }
-
- if ((null !== $calculate) && (int)$calculate === Mage_Catalog_Model_Product_Type_Abstract::CALCULATE_CHILD) {
- return true;
- }
- return false;
- }
-
-
- /**
- * Checking can we ship product separatelly (each child separately)
- * or each parent product item can be shipped only like one item
- *
- * @return bool
- */
- public function isShipSeparately() {
- if ($this->getParentItem()) {
- $shipmentType = $this->getParentItem()->getProduct()->getShipmentType();
- } else {
- $shipmentType = $this->getProduct()->getShipmentType();
- }
-
- if ((null !== $shipmentType) && (int)$shipmentType === Mage_Catalog_Model_Product_Type_Abstract::SHIPMENT_SEPARATELY) {
- return true;
- }
- return false;
- }
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Sales/Model/Quote/Payment.php b/app/code/core/Mage/Sales/Model/Quote/Payment.php
index 4cd8b95e3d..f1dbf5a901 100644
--- a/app/code/core/Mage/Sales/Model/Quote/Payment.php
+++ b/app/code/core/Mage/Sales/Model/Quote/Payment.php
@@ -66,11 +66,13 @@ public function getQuote()
}
/**
- * Import data
+ * Import data array to payment method object,
+ * Method calls quote totals collect because payment method availability
+ * can be related to quote totals
*
- * @param array $data
- * @throws Mage_Core_Exception
- * @return Mage_Sales_Model_Quote_Payment
+ * @param array $data
+ * @throws Mage_Core_Exception
+ * @return Mage_Sales_Model_Quote_Payment
*/
public function importData(array $data)
{
@@ -86,6 +88,12 @@ public function importData(array $data)
$this->setMethod($data->getMethod());
$method = $this->getMethodInstance();
+ /**
+ * Payment avalability related with quote totals.
+ * We have recollect quote totals before checking
+ */
+ $this->getQuote()->collectTotals();
+
if (!$method->isAvailable($this->getQuote())) {
Mage::throwException(Mage::helper('sales')->__('Requested Payment Method is not available'));
}
@@ -117,17 +125,31 @@ protected function _beforeSave()
return parent::_beforeSave();
}
+ /**
+ * Checkout redirect URL getter
+ *
+ * @return string
+ */
public function getCheckoutRedirectUrl()
{
$method = $this->getMethodInstance();
-
- return $method ? $method->getCheckoutRedirectUrl() : false;
+ if ($method) {
+ return $method->getCheckoutRedirectUrl();
+ }
+ return '';
}
+ /**
+ * Checkout order place redirect URL getter
+ *
+ * @return string
+ */
public function getOrderPlaceRedirectUrl()
{
$method = $this->getMethodInstance();
-
- return $method ? $method->getOrderPlaceRedirectUrl() : false;
+ if ($method) {
+ return $method->getOrderPlaceRedirectUrl();
+ }
+ return '';
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Sales/doc/order.txt b/app/code/core/Mage/Sales/doc/order.txt
index a8001294a2..678b8c17f6 100644
--- a/app/code/core/Mage/Sales/doc/order.txt
+++ b/app/code/core/Mage/Sales/doc/order.txt
@@ -20,7 +20,6 @@
billing_address_id
shipping_address_id
coupon_code
- giftcert_code
weight
shipping_method
shipping_description
@@ -28,7 +27,6 @@
tax_amount
shipping_amount
discount_amount
- giftcert_amount
custbalance_amount
grand_total
total_paid
diff --git a/app/code/core/Mage/Sales/doc/quote.txt b/app/code/core/Mage/Sales/doc/quote.txt
index 1774ccbd2a..d6b8988d23 100644
--- a/app/code/core/Mage/Sales/doc/quote.txt
+++ b/app/code/core/Mage/Sales/doc/quote.txt
@@ -9,7 +9,6 @@
billing_address_id
converted_at
coupon_code
- giftcert_code
custbalance_amount
global_currency_code
base_currency_code
diff --git a/app/code/core/Mage/Sales/etc/config.xml b/app/code/core/Mage/Sales/etc/config.xml
index 67389fa6e0..d68e0d08b2 100644
--- a/app/code/core/Mage/Sales/etc/config.xml
+++ b/app/code/core/Mage/Sales/etc/config.xml
@@ -28,7 +28,7 @@
- 0.9.38
+ 0.9.40
@@ -99,7 +99,6 @@
base_to_order_rate
*
- *
*
*
*
@@ -117,7 +116,6 @@
*
*
*
- *
*
*
@@ -126,7 +124,6 @@
*
*
*
- *
*
*
@@ -219,7 +216,6 @@
* *
*
- *
*
*
@@ -232,14 +228,12 @@
*
*
*
- *
*
*
*
*
*
- *
*
*
@@ -499,23 +493,11 @@
sales/quote_address_total_subtotal
grand_total
-
- sales/quote_address_total_discount
- subtotal
- grand_total,shipping
-
sales/quote_address_total_shipping
- subtotal,discount
+ subtotal,freeshipping
grand_total
-
- sales/quote_address_total_tax
- subtotal,shipping
- grand_total
- checkout/total_tax
- adminhtml/sales_order_create_totals_tax
-
sales/quote_address_total_grand
subtotal
@@ -626,6 +608,9 @@
sales/order_creditmemo_total_subtotal
+
+ sales/order_creditmemo_total_shipping
+
sales/order_creditmemo_total_tax
@@ -666,13 +651,6 @@
0
200
-
- Tax
- tax_amount
- 7
- 0
- 300
-
Shipping & Handling
shipping_amount
@@ -685,21 +663,21 @@
adjustment_positive
7
0
- 100
+ 500
Adjustment Fee
adjustment_negative
7
0
- 500
+ 600
Grand Total
grand_total
8
1
- 600
+ 700
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.7.0.php
index 8f190e0432..1a9583158d 100644
--- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.7.0.php
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.7.0.php
@@ -68,22 +68,6 @@
insert into {$this->getTable('sales_discount_coupon')}(`coupon_id`,`coupon_code`,`discount_percent`,`discount_fixed`,`is_active`,`from_date`,`to_date`,`min_subtotal`,`limit_products`,`limit_categories`,`limit_attributes`) values (1,'test',10.0000,0.0000,1,'0000-00-00 00:00:00','0000-00-00 00:00:00',0.0000,'','','');
-/*Table structure for table `sales_giftcert` */
-
--- DROP TABLE IF EXISTS {$this->getTable('sales_giftcert')};
-
-CREATE TABLE {$this->getTable('sales_giftcert')} (
- `giftcert_id` int(10) unsigned NOT NULL auto_increment,
- `giftcert_code` varchar(50) NOT NULL default '',
- `balance_amount` decimal(12,4) NOT NULL default '0.0000',
- PRIMARY KEY (`giftcert_id`),
- UNIQUE KEY `gift_code` (`giftcert_code`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-/*Data for the table `sales_giftcert` */
-
-insert into {$this->getTable('sales_giftcert')}(`giftcert_id`,`giftcert_code`,`balance_amount`) values (1,'test',20.0000);
-
/*Table structure for table `sales_invoice_entity` */
-- DROP TABLE IF EXISTS {$this->getTable('sales_invoice_entity')};
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.8.11.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.8.11.php
index 332686093b..374bda5e4f 100644
--- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.8.11.php
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-install-0.8.11.php
@@ -64,15 +64,6 @@
PRIMARY KEY (`coupon_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--- DROP TABLE IF EXISTS `{$installer->getTable('sales_giftcert')}`;
-CREATE TABLE `{$installer->getTable('sales_giftcert')}` (
- `giftcert_id` int(10) unsigned NOT NULL auto_increment,
- `giftcert_code` varchar(50) NOT NULL default '',
- `balance_amount` decimal(12,4) NOT NULL default '0.0000',
- PRIMARY KEY (`giftcert_id`),
- UNIQUE KEY `gift_code` (`giftcert_code`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-- DROP TABLE IF EXISTS `{$installer->getTable('sales_order_entity')}`;
CREATE TABLE `{$installer->getTable('sales_order_entity')}` (
`entity_id` int(10) unsigned NOT NULL auto_increment,
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.14-0.8.15.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.14-0.8.15.php
index f30a7f55dc..05111f5873 100644
--- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.14-0.8.15.php
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.14-0.8.15.php
@@ -63,7 +63,6 @@
`checkout_method` varchar(255) NOT NULL default '',
`password_hash` varchar(255) NOT NULL default '',
`coupon_code` varchar(255) NOT NULL default '',
- `giftcert_code` varchar(255) NOT NULL default '',
`base_currency_code` varchar(255) NOT NULL default '',
`store_currency_code` varchar(255) NOT NULL default '',
`quote_currency_code` varchar(255) NOT NULL default '',
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.17-0.8.18.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.17-0.8.18.php
index 2881a61b27..d6d565013f 100644
--- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.17-0.8.18.php
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.17-0.8.18.php
@@ -50,7 +50,6 @@
change `checkout_method` `checkout_method` varchar (255) NULL COLLATE utf8_general_ci ,
change `password_hash` `password_hash` varchar (255) NULL COLLATE utf8_general_ci ,
change `coupon_code` `coupon_code` varchar (255) NULL COLLATE utf8_general_ci ,
- change `giftcert_code` `giftcert_code` varchar (255) NULL COLLATE utf8_general_ci ,
change `base_currency_code` `base_currency_code` varchar (255) NULL COLLATE utf8_general_ci ,
change `store_currency_code` `store_currency_code` varchar (255) NULL COLLATE utf8_general_ci ,
change `quote_currency_code` `quote_currency_code` varchar (255) NULL COLLATE utf8_general_ci ,
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.29-0.9.0.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.29-0.9.0.php
index 543c8f1780..f05839bd0d 100644
--- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.29-0.9.0.php
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.29-0.9.0.php
@@ -349,6 +349,5 @@
DROP TABLE IF EXISTS {$this->getTable('sales_counter')};
DROP TABLE IF EXISTS {$this->getTable('sales_discount_coupon')};
-DROP TABLE IF EXISTS {$this->getTable('sales_giftcert')};
");
$installer->endSetup();
\ No newline at end of file
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.38-0.9.39.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.38-0.9.39.php
new file mode 100644
index 0000000000..acdc8c4cc7
--- /dev/null
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.38-0.9.39.php
@@ -0,0 +1,49 @@
+startSetup();
+$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'),
+ 'store_id', 'smallint(5) unsigned default null AFTER `product_id`');
+$installer->getConnection()->addConstraint('FK_SALES_QUOTE_ITEM_STORE',
+ $installer->getTable('sales/quote_item'), 'store_id',
+ $installer->getTable('core/store'), 'store_id',
+ 'set null', 'cascade'
+);
+$installer->getConnection()->addColumn($installer->getTable('sales/order_item'),
+ 'store_id', 'smallint(5) unsigned default null AFTER `quote_item_id`');
+$installer->getConnection()->addConstraint('FK_SALES_ORDER_ITEM_STORE',
+ $installer->getTable('sales/order_item'), 'store_id',
+ $installer->getTable('core/store'), 'store_id',
+ 'set null', 'cascade'
+);
+$installer->addAttribute('quote_item', 'redirect_url', array(
+ 'type' => 'varchar',
+));
+$installer->endSetup();
diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.39-0.9.40.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.39-0.9.40.php
new file mode 100644
index 0000000000..336ff8b27d
--- /dev/null
+++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.9.39-0.9.40.php
@@ -0,0 +1,32 @@
+startSetup();
+$this->removeAttribute('order', 'giftcert_code');
+$this->removeAttribute('order', 'giftcert_amount');
+$this->removeAttribute('order', 'base_giftcert_amount');
+$this->endSetup();
+
diff --git a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule.php b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule.php
index fd20e96f2e..4adb97a875 100644
--- a/app/code/core/Mage/SalesRule/Model/Mysql4/Rule.php
+++ b/app/code/core/Mage/SalesRule/Model/Mysql4/Rule.php
@@ -65,4 +65,66 @@ public function getCustomerUses($rule, $customerId)
->where('customer_id=?', $customerId);
return $read->fetchOne($select);
}
+
+ /**
+ * Save rule labels for different store views
+ *
+ * @param int $ruleId
+ * @param array $labels
+ * @return Mage_SalesRule_Model_Mysql4_Rule
+ */
+ public function saveStoreLabels($ruleId, $labels)
+ {
+ $delete = array();
+ $save = array();
+ $table = $this->getTable('salesrule/label');
+ $adapter = $this->_getWriteAdapter();
+
+ foreach ($labels as $storeId => $label) {
+ if (Mage::helper('core/string')->strlen($label)) {
+ $data = array('rule_id' => $ruleId, 'store_id' => $storeId, 'label' => $label);
+ $adapter->insertOnDuplicate($table, $data, array('label'));
+ } else {
+ $delete[] = $storeId;
+ }
+ }
+
+ if (!empty($delete)) {
+ $adapter->delete($table,
+ $adapter->quoteInto('rule_id=? AND ', $ruleId) . $adapter->quoteInto('store_id IN (?)', $delete)
+ );
+ }
+ return $this;
+ }
+
+ /**
+ * Get all existing rule labels
+ *
+ * @param int $ruleId
+ * @return array
+ */
+ public function getStoreLabels($ruleId)
+ {
+ $select = $this->_getReadAdapter()->select()
+ ->from($this->getTable('salesrule/label'), array('store_id', 'label'))
+ ->where('rule_id=?', $ruleId);
+ return $this->_getReadAdapter()->fetchPairs($select);
+ }
+
+ /**
+ * Get rule label by specific store id
+ *
+ * @param int $ruleId
+ * @param int $storeId
+ * @return string
+ */
+ public function getStoreLabel($ruleId, $storeId)
+ {
+ $select = $this->_getReadAdapter()->select()
+ ->from($this->getTable('salesrule/label'), 'label')
+ ->where('rule_id=?', $ruleId)
+ ->where('store_id IN(?)', array($storeId, 0))
+ ->order('store_id DESC');
+ return $this->_getReadAdapter()->fetchOne($select);
+ }
}
\ No newline at end of file
diff --git a/app/code/core/Mage/SalesRule/Model/Observer.php b/app/code/core/Mage/SalesRule/Model/Observer.php
index 9ab232c475..310394a297 100644
--- a/app/code/core/Mage/SalesRule/Model/Observer.php
+++ b/app/code/core/Mage/SalesRule/Model/Observer.php
@@ -29,6 +29,13 @@ class Mage_SalesRule_Model_Observer
{
protected $_validator;
+ /**
+ * Get quote item validator/processor object
+ *
+ * @deprecated
+ * @param Varien_Event $event
+ * @return Mage_SalesRule_Model_Validator
+ */
public function getValidator($event)
{
if (!$this->_validator) {
@@ -38,6 +45,12 @@ public function getValidator($event)
return $this->_validator;
}
+ /**
+ * Process quote item (apply discount to item)
+ *
+ * @deprecated process call movet to total model
+ * @param Varien_Event_Observer $observer
+ */
public function sales_quote_address_discount_item($observer)
{
$this->getValidator($observer->getEvent())
diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Discount.php b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php
new file mode 100644
index 0000000000..81cc04e072
--- /dev/null
+++ b/app/code/core/Mage/SalesRule/Model/Quote/Discount.php
@@ -0,0 +1,152 @@
+setCode('discount');
+ $this->_calculator = Mage::getSingleton('salesrule/validator');
+ }
+
+ /**
+ * Collect address discount amount
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_SalesRule_Model_Quote_Discount
+ */
+ public function collect(Mage_Sales_Model_Quote_Address $address)
+ {
+ parent::collect($address);
+ $quote = $address->getQuote();
+ $store = Mage::app()->getStore($quote->getStoreId());
+
+ $items = $address->getAllItems();
+ if (!count($items)) {
+ return $this;
+ }
+
+ $eventArgs = array(
+ 'website_id' => $store->getWebsiteId(),
+ 'customer_group_id' => $quote->getCustomerGroupId(),
+ 'coupon_code' => $quote->getCouponCode(),
+ );
+
+ $this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());
+ $address->setDiscountDescription(array());
+
+ foreach ($items as $item) {
+ if ($item->getNoDiscount()) {
+ $item->setDiscountAmount(0);
+ $item->setBaseDiscountAmount(0);
+ }
+ else {
+ /**
+ * Child item discount we calculate for parent
+ */
+ if ($item->getParentItemId()) {
+ continue;
+ }
+
+ $eventArgs['item'] = $item;
+ Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
+
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
+ foreach ($item->getChildren() as $child) {
+ $this->_calculator->process($child);
+ $eventArgs['item'] = $child;
+ Mage::dispatchEvent('sales_quote_address_discount_item', $eventArgs);
+ $this->_aggregateItemDiscount($child);
+ }
+ } else {
+ $this->_calculator->process($item);
+ $this->_aggregateItemDiscount($item);
+ }
+ }
+ }
+
+ /**
+ * Process shipping amount discount
+ */
+ $address->setShippingDiscountAmount(0);
+ $address->setBaseShippingDiscountAmount(0);
+ if ($address->getShippingAmount()) {
+ $this->_calculator->processShippingAmount($address);
+ $this->_addAmount(-$address->getShippingDiscountAmount());
+ $this->_addBaseAmount(-$address->getBaseShippingDiscountAmount());
+ }
+
+ $this->_calculator->prepareDescription($address);
+ return $this;
+ }
+
+ /**
+ * Aggregate item discount information to address data and related properties
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @return Mage_SalesRule_Model_Quote_Discount
+ */
+ protected function _aggregateItemDiscount($item)
+ {
+ $this->_addAmount(-$item->getDiscountAmount());
+ $this->_addBaseAmount(-$item->getBaseDiscountAmount());
+ return $this;
+ }
+
+ /**
+ * Add discount total information to address
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_SalesRule_Model_Quote_Discount
+ */
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
+ {
+ $amount = $address->getDiscountAmount();
+
+ if ($amount!=0) {
+ $description = $address->getDiscountDescription();
+ if ($description) {
+ $title = Mage::helper('sales')->__('Discount (%s)', $description);
+ } else {
+ $title = Mage::helper('sales')->__('Discount');
+ }
+ $address->addTotal(array(
+ 'code' => $this->getCode(),
+ 'title' => $title,
+ 'value' => $amount
+ ));
+ }
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php b/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php
new file mode 100644
index 0000000000..0982a063c9
--- /dev/null
+++ b/app/code/core/Mage/SalesRule/Model/Quote/Freeshipping.php
@@ -0,0 +1,103 @@
+setCode('discount');
+ $this->_calculator = Mage::getSingleton('salesrule/validator');
+ }
+
+ /**
+ * Collect information about free shipping for all address items
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_SalesRule_Model_Quote_Freeshipping
+ */
+ public function collect(Mage_Sales_Model_Quote_Address $address)
+ {
+ parent::collect($address);
+ $quote = $address->getQuote();
+ $store = Mage::app()->getStore($quote->getStoreId());
+
+ $address->setFreeShipping(0);
+ $items = $address->getAllItems();
+
+ if (!count($items)) {
+ return $this;
+ }
+ $this->_calculator->init($store->getWebsiteId(), $quote->getCustomerGroupId(), $quote->getCouponCode());
+
+ foreach ($items as $item) {
+ if ($item->getNoDiscount()) {
+ $item->setFreeShipping(false);
+ } else {
+ /**
+ * Child item discount we calculate for parent
+ */
+ if ($item->getParentItemId()) {
+ continue;
+ }
+ $this->_calculator->processFreeShipping($item);
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
+ foreach ($item->getChildren() as $child) {
+ $this->_calculator->processFreeShipping($child);
+ /**
+ * Parent free shipping we apply to all children
+ */
+ if ($item->getFreeShipping()) {
+ $child->setFreeShipping($item->getFreeShipping());
+ }
+
+ }
+ }
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Add information about free shipping for all address items to address object
+ * By default we not present such information
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_SalesRule_Model_Quote_Freeshipping
+ */
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
+ {
+ return $this;
+ }
+
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/SalesRule/Model/Rule.php b/app/code/core/Mage/SalesRule/Model/Rule.php
index 432efeb399..740ae254d5 100644
--- a/app/code/core/Mage/SalesRule/Model/Rule.php
+++ b/app/code/core/Mage/SalesRule/Model/Rule.php
@@ -30,6 +30,8 @@ class Mage_SalesRule_Model_Rule extends Mage_Rule_Model_Rule
const FREE_SHIPPING_ITEM = 1;
const FREE_SHIPPING_ADDRESS = 2;
+ protected $_labels = array();
+
protected function _construct()
{
parent::_construct();
@@ -37,9 +39,15 @@ protected function _construct()
$this->setIdFieldName('rule_id');
}
+ /**
+ * Check unique coupon code before saving and clear coupon related cache
+ *
+ * @return Mage_SalesRule_Model_Rule
+ */
protected function _beforeSave()
{
- if($coupon = $this->getCouponCode()) {
+ $coupon = $this->getCouponCode();
+ if($coupon) {
$this->getResource()->addUniqueField(array(
'field' => 'coupon_code',
'title' => Mage::helper('salesRule')->__('Coupon with the same code')
@@ -51,13 +59,18 @@ protected function _beforeSave()
return parent::_beforeSave();
}
-
+ /**
+ * Delete rule coupon code related cache
+ *
+ * @return Mage_SalesRule_Model_Rule
+ */
protected function _beforeDelete()
{
- if ($coupon = $this->getCouponCode()) {
+ $coupon = $this->getCouponCode();
+ if ($coupon) {
Mage::app()->cleanCache('salesrule_coupon_'.$coupon);
}
- parent::_beforeDelete();
+ return parent::_beforeDelete();
}
public function getConditionsInstance()
@@ -83,16 +96,24 @@ public function toString($format='')
return $str;
}
+ /**
+ * Initialize rule model data from array
+ *
+ * @param array $rule
+ * @return Mage_SalesRule_Model_Rule
+ */
public function loadPost(array $rule)
{
$arr = $this->_convertFlatToRecursive($rule);
- if (isset($arr['conditions'])) {
- $this->getConditions()->setConditions(array())->loadArray($arr['conditions'][1]);
- }
- if (isset($arr['actions'])) {
- $this->getActions()->setActions(array())->loadArray($arr['actions'][1], 'actions');
- }
-
+ if (isset($arr['conditions'])) {
+ $this->getConditions()->setConditions(array())->loadArray($arr['conditions'][1]);
+ }
+ if (isset($arr['actions'])) {
+ $this->getActions()->setActions(array())->loadArray($arr['actions'][1], 'actions');
+ }
+ if (isset($rule['store_labels'])) {
+ $this->setStoreLabels($rule['store_labels']);
+ }
return $this;
}
@@ -116,56 +137,59 @@ public function toArray(array $arrAttributes = array())
return $out;
}
- /*
- public function processProduct(Mage_Sales_Model_Product $product)
+
+ public function getResourceCollection()
{
- $this->validateProduct($product) && $this->updateProduct($product);
- return $this;
+ return Mage::getResourceModel('salesrule/rule_collection');
}
- public function validateProduct(Mage_Sales_Model_Product $product)
+ /**
+ * Save rula labels after rule save
+ *
+ * @return Mage_SalesRule_Model_Rule
+ */
+ protected function _afterSave()
{
- if (!$this->getIsCollectionValidated()) {
- $env = $this->getEnv();
- $result = $result && $this->getIsActive()
- && (strtotime($this->getStartAt()) <= $env->getNow())
- && (strtotime($this->getExpireAt()) >= $env->getNow())
- && ($this->getCustomerRegistered()==2 || $this->getCustomerRegistered()==$env->getCustomerRegistered())
- && ($this->getCustomerNewBuyer()==2 || $this->getCustomerNewBuyer()==$env->getCustomerNewBuyer())
- && $this->getConditions()->validateProduct($product);
- } else {
- $result = $this->getConditions()->validateProduct($product);
+ if ($this->hasStoreLabels()) {
+ $this->_getResource()->saveStoreLabels($this->getId(), $this->getStoreLabels());
}
-
- return $result;
+ return parent::_afterSave();
}
- public function updateProduct(Mage_Sales_Model_Product $product)
+ /**
+ * Get Rule label for specific store
+ *
+ * @param store $store
+ * @return string | false
+ */
+ public function getStoreLabel($store=null)
{
- $this->getActions()->updateProduct($product);
- return $this;
+ $storeId = Mage::app()->getStore($store)->getId();
+ if ($this->hasStoreLabels()) {
+ $labels = $this->_getData('store_labels');
+ if (isset($labels[$storeId])) {
+ return $labels[$storeId];
+ } elseif ($labels[0]) {
+ return $labels[0];
+ }
+ return false;
+ } elseif (!isset($this->_labels[$storeId])) {
+ $this->_labels[$storeId] = $this->_getResource()->getStoreLabel($this->getId(), $storeId);
+ }
+ return $this->_labels[$storeId];
}
- */
- public function getResourceCollection()
+
+ /**
+ * Get all existing rule labels
+ *
+ * @return array
+ */
+ public function getStoreLabels()
{
- return Mage::getResourceModel('salesrule/rule_collection');
+ if (!$this->hasStoreLabels()) {
+ $labels = $this->_getResource()->getStoreLabels($this->getId());
+ $this->setStoreLabels($labels);
+ }
+ return $this->_getData('store_labels');
}
-
-// protected function _afterSave()
-// {
-// $this->_getResource()->updateRuleProductData($this);
-// parent::_afterSave();
-// }
-//
-// public function validate(Varien_Object $quote)
-// {
-//
-// if ($this->getUsesPerCustomer() && $quote->getCustomer()) {
-// $customerUses = $this->_getResource()->getCustomerUses($this, $quote->getCustomerId());
-// if ($customerUses >= $this->getUsesPerCustomer()) {
-// return false;
-// }
-// }
-// return parent::validate($quote);
-// }
}
diff --git a/app/code/core/Mage/SalesRule/Model/Validator.php b/app/code/core/Mage/SalesRule/Model/Validator.php
index b3991609d9..4f56703cca 100644
--- a/app/code/core/Mage/SalesRule/Model/Validator.php
+++ b/app/code/core/Mage/SalesRule/Model/Validator.php
@@ -43,6 +43,9 @@ class Mage_SalesRule_Model_Validator extends Mage_Core_Model_Abstract
*/
protected $_rules;
+ protected $_roundingDeltas = array();
+ protected $_baseRoundingDeltas = array();
+
protected function _construct()
{
parent::_construct();
@@ -51,133 +54,214 @@ protected function _construct()
/**
* Init validator
+ * Init process load collection of rules for specific website,
+ * customer group and coupon code
*
- * @param int $websiteId
- * @param int $customerGroupId
- * @param string $couponCode
- * @return Mage_SalesRule_Model_Validator
+ * @param int $websiteId
+ * @param int $customerGroupId
+ * @param string $couponCode
+ * @return Mage_SalesRule_Model_Validator
*/
public function init($websiteId, $customerGroupId, $couponCode)
{
$this->setWebsiteId($websiteId)
- ->setCustomerGroupId($customerGroupId)
- ->setCouponCode($couponCode);
-
- $this->_rules = Mage::getResourceModel('salesrule/rule_collection')
- ->setValidationFilter($websiteId, $customerGroupId, $couponCode)
- ->load();
+ ->setCustomerGroupId($customerGroupId)
+ ->setCouponCode($couponCode);
+ $key = $websiteId . '_' . $customerGroupId . '_' . $couponCode;
+ if (!isset($this->_rules[$key])) {
+ $this->_rules[$key] = Mage::getResourceModel('salesrule/rule_collection')
+ ->setValidationFilter($websiteId, $customerGroupId, $couponCode)
+ ->load();
+ }
return $this;
}
- public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
+ /**
+ * Get rules collection for current object state
+ *
+ * @return Mage_SalesRule_Model_Mysql4_Rule_Collection
+ */
+ protected function _getRules()
{
- $item->setFreeShipping(false);
- $item->setDiscountAmount(0);
- $item->setBaseDiscountAmount(0);
- $item->setDiscountPercent(0);
+ $key = $this->getWebsiteId() . '_' . $this->getCustomerGroupId() . '_' . $this->getCouponCode();
+ return $this->_rules[$key];
+ }
- $quote = $item->getQuote();
+ /**
+ * Get address object which can be used for discount calculation
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @return Mage_Sales_Model_Quote_Address
+ */
+ protected function _getAddress(Mage_Sales_Model_Quote_Item_Abstract $item)
+ {
if ($item instanceof Mage_Sales_Model_Quote_Address_Item) {
$address = $item->getAddress();
- } elseif ($quote->isVirtual()) {
- $address = $quote->getBillingAddress();
+ } elseif ($item->getQuote()->isVirtual()) {
+ $address = $item->getQuote()->getBillingAddress();
} else {
- $address = $quote->getShippingAddress();
+ $address = $item->getQuote()->getShippingAddress();
}
+ return $address;
+ }
- $customerId = $quote->getCustomerId();
- $ruleCustomer = Mage::getModel('salesrule/rule_customer');
- $appliedRuleIds = array();
-
- foreach ($this->_rules as $rule) {
- /* @var $rule Mage_SalesRule_Model_Rule */
+ /**
+ * Check if rule can be applied for specific address/quote/customer
+ *
+ * @param Mage_SalesRule_Model_Rule $rule
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return bool
+ */
+ protected function _canProcessRule($rule, $address)
+ {
+ if (!$rule->hasIsValid()) {
/**
- * already tried to validate and failed
+ * too many times used in general
*/
- if ($rule->getIsValid() === false) {
- continue;
+ if ($rule->getUsesPerCoupon() && ($rule->getTimesUsed() >= $rule->getUsesPerCoupon())) {
+ $rule->setIsValid(false);
+ return false;
}
-
- if ($rule->getIsValid() !== true) {
- /**
- * too many times used in general
- */
- if ($rule->getUsesPerCoupon() && ($rule->getTimesUsed() >= $rule->getUsesPerCoupon())) {
- $rule->setIsValid(false);
- continue;
- }
- /**
- * too many times used for this customer
- */
- $ruleId = $rule->getId();
- if ($ruleId && $rule->getUsesPerCustomer()) {
- $ruleCustomer->loadByCustomerRule($customerId, $ruleId);
- if ($ruleCustomer->getId()) {
- if ($ruleCustomer->getTimesUsed() >= $rule->getUsesPerCustomer()) {
- continue;
- }
+ /**
+ * too many times used for this customer
+ */
+ $ruleId = $rule->getId();
+ if ($ruleId && $rule->getUsesPerCustomer()) {
+ $customerId = $address->getQuote()->getCustomerId();
+ $ruleCustomer = Mage::getModel('salesrule/rule_customer');
+ $ruleCustomer->loadByCustomerRule($customerId, $ruleId);
+ if ($ruleCustomer->getId()) {
+ if ($ruleCustomer->getTimesUsed() >= $rule->getUsesPerCustomer()) {
+ $rule->setIsValid(false);
+ return false;
}
}
- $rule->afterLoad();
- /**
- * quote does not meet rule's conditions
- */
- if (!$rule->validate($address)) {
- $rule->setIsValid(false);
- continue;
- }
- /**
- * passed all validations, remember to be valid
- */
- $rule->setIsValid(true);
}
-
+ $rule->afterLoad();
/**
- * although the rule is valid, this item is not marked for action
+ * quote does not meet rule's conditions
*/
+ if (!$rule->validate($address)) {
+ $rule->setIsValid(false);
+ return false;
+ }
+ /**
+ * passed all validations, remember to be valid
+ */
+ $rule->setIsValid(true);
+ }
+ return $rule->getIsValid();
+
+ }
+
+ /**
+ * Quote item free shipping ability check
+ * This process not affect information about applied rules, coupon code etc.
+ * This information will be added during discount amounts processing
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @return Mage_SalesRule_Model_Validator
+ */
+ public function processFreeShipping(Mage_Sales_Model_Quote_Item_Abstract $item)
+ {
+ $address = $this->_getAddress($item);
+ $item->setFreeShipping(false);
+
+ foreach ($this->_getRules() as $rule) {
+ /* @var $rule Mage_SalesRule_Model_Rule */
+ if (!$this->_canProcessRule($rule, $address)) {
+ continue;
+ }
+
if (!$rule->getActions()->validate($item)) {
continue;
}
- $qty = $item->getQty();
- if ($item->getParentItem()) {
- $qty*= $item->getParentItem()->getQty();
+
+ switch ($rule->getSimpleFreeShipping()) {
+ case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM:
+ $item->setFreeShipping($rule->getDiscountQty() ? $rule->getDiscountQty() : true);
+ break;
+
+ case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS:
+ $address->setFreeShipping(true);
+ break;
+ }
+ if ($rule->getStopRulesProcessing()) {
+ break;
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Quote item discount calculation process
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @return Mage_SalesRule_Model_Validator
+ */
+ public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
+ {
+ $item->setDiscountAmount(0);
+ $item->setBaseDiscountAmount(0);
+ $item->setDiscountPercent(0);
+ $quote = $item->getQuote();
+ $address = $this->_getAddress($item);
+ $itemPrice = $item->getDiscountCalculationPrice();
+ if ($itemPrice !== null) {
+ $baseItemPrice = $item->getBaseDiscountCalculationPrice();
+ } else {
+ $itemPrice = $item->getCalculationPrice();
+ $baseItemPrice = $item->getBaseCalculationPrice();
+ }
+
+ $appliedRuleIds = array();
+ foreach ($this->_getRules() as $rule) {
+ /* @var $rule Mage_SalesRule_Model_Rule */
+ if (!$this->_canProcessRule($rule, $address)) {
+ continue;
+ }
+
+ if (!$rule->getActions()->validate($item)) {
+ continue;
}
+ $qty = $item->getTotalQty();
$qty = $rule->getDiscountQty() ? min($qty, $rule->getDiscountQty()) : $qty;
$rulePercent = min(100, $rule->getDiscountAmount());
+
$discountAmount = 0;
$baseDiscountAmount = 0;
switch ($rule->getSimpleAction()) {
case 'to_percent':
$rulePercent = max(0, 100-$rule->getDiscountAmount());
//no break;
-
case 'by_percent':
- if ($step = $rule->getDiscountStep()) {
+ $step = $rule->getDiscountStep();
+ if ($step) {
$qty = floor($qty/$step)*$step;
}
- $discountAmount = ($qty*$item->getCalculationPrice() - $item->getDiscountAmount()) * $rulePercent/100;
- $baseDiscountAmount= ($qty*$item->getBaseCalculationPrice() - $item->getBaseDiscountAmount()) * $rulePercent/100;
+ $discountAmount = ($qty*$itemPrice - $item->getDiscountAmount()) * $rulePercent/100;
+ $baseDiscountAmount= ($qty*$baseItemPrice - $item->getBaseDiscountAmount()) * $rulePercent/100;
if (!$rule->getDiscountQty() || $rule->getDiscountQty()>$qty) {
$discountPercent = min(100, $item->getDiscountPercent()+$rulePercent);
$item->setDiscountPercent($discountPercent);
}
break;
-
case 'to_fixed':
$quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
- $discountAmount = $qty*($item->getCalculationPrice()-$quoteAmount);
- $baseDiscountAmount= $qty*($item->getBaseCalculationPrice()-$rule->getDiscountAmount());
+ $discountAmount = $qty*($itemPrice-$quoteAmount);
+ $baseDiscountAmount= $qty*($baseItemPrice-$rule->getDiscountAmount());
break;
case 'by_fixed':
- if ($step = $rule->getDiscountStep()) {
+ $step = $rule->getDiscountStep();
+ if ($step) {
$qty = floor($qty/$step)*$step;
}
- $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
- $discountAmount = $qty*$quoteAmount;
- $baseDiscountAmount= $qty*$rule->getDiscountAmount();
+ $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
+ $discountAmount = $qty*$quoteAmount;
+ $baseDiscountAmount = $qty*$rule->getDiscountAmount();
break;
case 'cart_fixed':
@@ -186,9 +270,12 @@ public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
$cartRules[$rule->getId()] = $rule->getDiscountAmount();
}
if ($cartRules[$rule->getId()] > 0) {
- $quoteAmount = $quote->getStore()->convertPrice($cartRules[$rule->getId()]);
- $discountAmount = min($item->getRowTotal(), $quoteAmount);
- $baseDiscountAmount = min($item->getBaseRowTotal(), $cartRules[$rule->getId()]);
+ $quoteAmount = $quote->getStore()->convertPrice($cartRules[$rule->getId()]);
+ /**
+ * We can't use row total here because row total not include tax
+ */
+ $discountAmount = min($itemPrice*$qty, $quoteAmount);
+ $baseDiscountAmount = min($baseItemPrice*$qty, $cartRules[$rule->getId()]);
$cartRules[$rule->getId()] -= $baseDiscountAmount;
}
$address->setCartFixedRules($cartRules);
@@ -211,8 +298,8 @@ public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
break;
}
}
- $discountAmount = $free*$item->getCalculationPrice();
- $baseDiscountAmount= $free*$item->getBaseCalculationPrice();
+ $discountAmount = $free*$itemPrice;
+ $baseDiscountAmount= $free*$baseItemPrice;
break;
}
@@ -232,35 +319,126 @@ public function process(Mage_Sales_Model_Quote_Item_Abstract $item)
$discountAmount = $result->getDiscountAmount();
$baseDiscountAmount = $result->getBaseDiscountAmount();
- $discountAmount = $quote->getStore()->roundPrice($discountAmount);
- $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
- $discountAmount = min($item->getDiscountAmount()+$discountAmount, $item->getRowTotal());
- $baseDiscountAmount = min($item->getBaseDiscountAmount()+$baseDiscountAmount, $item->getBaseRowTotal());
+ $percentKey = $item->getDiscountPercent();
+ /**
+ * Process "delta" rounding
+ */
+ if ($percentKey) {
+ $delta = isset($this->_roundingDeltas[$percentKey]) ? $this->_roundingDeltas[$percentKey] : 0;
+ $baseDelta = isset($this->_baseRoundingDeltas[$percentKey]) ? $this->_baseRoundingDeltas[$percentKey] : 0;
+ $discountAmount+= $delta;
+ $baseDiscountAmount+=$baseDelta;
+
+ $this->_roundingDeltas[$percentKey] = $discountAmount - $quote->getStore()->roundPrice($discountAmount);
+ $this->_baseRoundingDeltas[$percentKey] = $baseDiscountAmount - $quote->getStore()->roundPrice($baseDiscountAmount);
+ $discountAmount = $quote->getStore()->roundPrice($discountAmount);
+ $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
+ } else {
+ $discountAmount = $quote->getStore()->roundPrice($discountAmount);
+ $baseDiscountAmount = $quote->getStore()->roundPrice($baseDiscountAmount);
+ }
+
+ /**
+ * We can't use row total here because row total not include tax
+ * Discount can be applied on price included tax
+ */
+ $discountAmount = min($item->getDiscountAmount()+$discountAmount, $itemPrice*$qty);
+ $baseDiscountAmount = min($item->getBaseDiscountAmount()+$baseDiscountAmount, $baseItemPrice*$qty);
$item->setDiscountAmount($discountAmount);
$item->setBaseDiscountAmount($baseDiscountAmount);
- switch ($rule->getSimpleFreeShipping()) {
- case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ITEM:
- $item->setFreeShipping($rule->getDiscountQty() ? $rule->getDiscountQty() : true);
+ $appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId();
+
+ if ($rule->getCouponCode() && ( strtolower($rule->getCouponCode()) == strtolower($this->getCouponCode()))) {
+ $address->setCouponCode($this->getCouponCode());
+ }
+ $this->_addDiscountDescription($address, $rule);
+ if ($rule->getStopRulesProcessing()) {
+ break;
+ }
+ }
+ $item->setAppliedRuleIds(join(',',$appliedRuleIds));
+ $address->setAppliedRuleIds($this->mergeIds($address->getAppliedRuleIds(), $appliedRuleIds));
+ $quote->setAppliedRuleIds($this->mergeIds($quote->getAppliedRuleIds(), $appliedRuleIds));
+ return $this;
+ }
+
+ /**
+ * Apply discounts to shipping amount
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_SalesRule_Model_Validator
+ */
+ public function processShippingAmount(Mage_Sales_Model_Quote_Address $address)
+ {
+ $shippingAmount = $address->getShippingAmountForDiscount();
+ if ($shippingAmount!==null) {
+ $baseShippingAmount = $address->getBaseShippingAmountForDiscount();
+ } else {
+ $shippingAmount = $address->getShippingAmount();
+ $baseShippingAmount = $address->getBaseShippingAmount();
+ }
+ $quote = $address->getQuote();
+ $appliedRuleIds = array();
+ foreach ($this->_getRules() as $rule) {
+ /* @var $rule Mage_SalesRule_Model_Rule */
+ if (!$rule->getApplyToShipping() || !$this->_canProcessRule($rule, $address)) {
+ continue;
+ }
+
+ $discountAmount = 0;
+ $baseDiscountAmount = 0;
+ $rulePercent = min(100, $rule->getDiscountAmount());
+ switch ($rule->getSimpleAction()) {
+ case 'to_percent':
+ $rulePercent = max(0, 100-$rule->getDiscountAmount());
+ case 'by_percent':
+ $discountAmount = ($shippingAmount - $address->getShippingDiscountAmount()) * $rulePercent/100;
+ $baseDiscountAmount= ($baseShippingAmount - $address->getBaseShippingDiscountAmount()) * $rulePercent/100;
+ $discountPercent = min(100, $address->getShippingDiscountPercent()+$rulePercent);
+ $address->setShippingDiscountPercent($discountPercent);
+ break;
+ case 'to_fixed':
+ $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
+ $discountAmount = $shippingAmount-$quoteAmount;
+ $baseDiscountAmount= $baseShippingAmount-$rule->getDiscountAmount();
+ break;
+ case 'by_fixed':
+ $quoteAmount = $quote->getStore()->convertPrice($rule->getDiscountAmount());
+ $discountAmount = $quoteAmount;
+ $baseDiscountAmount = $rule->getDiscountAmount();
break;
- case Mage_SalesRule_Model_Rule::FREE_SHIPPING_ADDRESS:
- $address->setFreeShipping(true);
+ case 'cart_fixed':
+ $cartRules = $address->getCartFixedRules();
+ if (!isset($cartRules[$rule->getId()])) {
+ $cartRules[$rule->getId()] = $rule->getDiscountAmount();
+ }
+ if ($cartRules[$rule->getId()] > 0) {
+ $quoteAmount = $quote->getStore()->convertPrice($cartRules[$rule->getId()]);
+ $discountAmount = min($shippingAmount, $quoteAmount);
+ $baseDiscountAmount = min($baseShippingAmount, $cartRules[$rule->getId()]);
+ $cartRules[$rule->getId()] -= $baseDiscountAmount;
+ }
+ $address->setCartFixedRules($cartRules);
break;
}
+ $discountAmount = min($address->getShippingDiscountAmount()+$discountAmount, $shippingAmount);
+ $baseDiscountAmount = min($address->getBaseShippingDiscountAmount()+$baseDiscountAmount, $baseShippingAmount);
+ $address->setShippingDiscountAmount($discountAmount);
+ $address->setBaseShippingDiscountAmount($baseDiscountAmount);
$appliedRuleIds[$rule->getRuleId()] = $rule->getRuleId();
if ($rule->getCouponCode() && ( strtolower($rule->getCouponCode()) == strtolower($this->getCouponCode()))) {
$address->setCouponCode($this->getCouponCode());
}
-
+ $this->_addDiscountDescription($address, $rule);
if ($rule->getStopRulesProcessing()) {
break;
}
}
- $item->setAppliedRuleIds(join(',',$appliedRuleIds));
$address->setAppliedRuleIds($this->mergeIds($address->getAppliedRuleIds(), $appliedRuleIds));
$quote->setAppliedRuleIds($this->mergeIds($quote->getAppliedRuleIds(), $appliedRuleIds));
return $this;
@@ -280,4 +458,49 @@ public function mergeIds($a1, $a2, $asString=true)
}
return $a;
}
+
+ /**
+ * Add rule discount description label to address object
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @param Mage_SalesRule_Model_Rule $rule
+ * @return Mage_SalesRule_Model_Validator
+ */
+ protected function _addDiscountDescription($address, $rule)
+ {
+ $description = $address->getDiscountDescriptionArray();
+ $ruleLabel = $rule->getStoreLabel($address->getQuote()->getStore());
+ $label = '';
+ if ($ruleLabel) {
+ $label = $ruleLabel;
+ } elseif ($rule->getCouponCode()) {
+ $label = $rule->getCouponCode();
+ }
+
+ if (!empty($label)) {
+ $description[$rule->getId()] = $label;
+ }
+ $address->setDiscountDescriptionArray($description);
+ return $this;
+ }
+
+ /**
+ * Convert address discount description array to string
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @param string $separator
+ * @return Mage_SalesRule_Model_Validator
+ */
+ public function prepareDescription($address, $separator=', ')
+ {
+ $description = $address->getDiscountDescriptionArray();
+
+ if (is_array($description) && !empty($description)) {
+ $description = implode($separator, $description);
+ } else {
+ $description = '';
+ }
+ $address->setDiscountDescription($description);
+ return $this;
+ }
}
diff --git a/app/code/core/Mage/SalesRule/etc/config.xml b/app/code/core/Mage/SalesRule/etc/config.xml
index 0fca08fa66..1c81493168 100644
--- a/app/code/core/Mage/SalesRule/etc/config.xml
+++ b/app/code/core/Mage/SalesRule/etc/config.xml
@@ -28,7 +28,7 @@
- 0.7.7
+ 0.7.9
@@ -45,12 +45,9 @@
Mage_SalesRule_Model_Mysql4
-
-
-
-
-
-
+
+
+
@@ -58,6 +55,7 @@
Mage_SalesRule
+ Mage_Sales_Model_Mysql4_Setup
core_setup
@@ -74,17 +72,14 @@
-
+
+
+ *
+ *
+ *
+
+
-
-
-
- singleton
- salesrule/observer
- sales_quote_address_discount_item
-
-
-
@@ -95,6 +90,22 @@
+
+
+
+
+ salesrule/quote_freeshipping
+ subtotal
+ shipping
+
+
+ salesrule/quote_discount
+ subtotal,shipping
+ grand_total
+
+
+
+
diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.7-0.7.8.php
new file mode 100644
index 0000000000..fd6f5b15e7
--- /dev/null
+++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.7-0.7.8.php
@@ -0,0 +1,39 @@
+addAttribute('quote_address', 'discount_description', array('type'=>'varchar'));
+$installer->addAttribute('quote_address', 'shipping_discount_amount', array('type'=>'decimal'));
+$installer->addAttribute('quote_address', 'base_shipping_discount_amount', array('type'=>'decimal'));
+
+
+$installer->addAttribute('order', 'discount_description', array('type'=>'varchar'));
+$installer->addAttribute('order', 'shipping_discount_amount', array('type'=>'decimal'));
+$installer->addAttribute('order', 'base_shipping_discount_amount', array('type'=>'decimal'));
diff --git a/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.8-0.7.9.php
new file mode 100644
index 0000000000..f9d5d765d3
--- /dev/null
+++ b/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-0.7.8-0.7.9.php
@@ -0,0 +1,48 @@
+getConnection()->addColumn(
+ $this->getTable('salesrule'),
+ 'apply_to_shipping',
+ "tinyint(1) unsigned not null default '0' after simple_free_shipping"
+);
+
+$installer->run("
+CREATE TABLE `{$this->getTable('salesrule/label')}` (
+ `label_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `rule_id` int(10) unsigned NOT NULL,
+ `store_id` smallint(5) unsigned NOT NULL,
+ `label` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`label_id`),
+ UNIQUE KEY `IDX_RULE_STORE` (`rule_id`,`store_id`),
+ KEY `FK_SALESRULE_LABEL_STORE` (`store_id`),
+ KEY `FK_SALESRULE_LABEL_RULE` (`rule_id`),
+ CONSTRAINT `FK_SALESRULE_LABEL_RULE` FOREIGN KEY (`rule_id`) REFERENCES `{$this->getTable('salesrule')}` (`rule_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `FK_SALESRULE_LABEL_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+");
\ No newline at end of file
diff --git a/app/code/core/Mage/Sendfriend/Block/Send.php b/app/code/core/Mage/Sendfriend/Block/Send.php
index 5d90eff7de..a93e2c0dc2 100644
--- a/app/code/core/Mage/Sendfriend/Block/Send.php
+++ b/app/code/core/Mage/Sendfriend/Block/Send.php
@@ -18,61 +18,147 @@
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
- * @category Mage
- * @package Mage_Sendfriend
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ * @category Mage
+ * @package Mage_Sendfriend
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+/**
+ * Email to a Friend Block
+ *
+ * @category Mage
+ * @package Mage_Sendfriend
+ * @author Magento Core Team
+ */
class Mage_Sendfriend_Block_Send extends Mage_Core_Block_Template
{
- /**
+ /**
* Retrieve username for form field
*
* @return string
*/
public function getUserName()
{
- if ($name = $this->getFormData()->getData('sender/name')) {
- return $name;
+ $name = $this->getFormData()->getData('sender/name');
+ if (!empty($name)) {
+ return trim($name);
+ }
+
+ /* @var $session Mage_Customer_Model_Session */
+ $session = Mage::getSingleton('customer/session');
+
+ if ($session->isLoggedIn()) {
+ return $session->getCustomer()->getName();
}
- $firstName =(string)Mage::getSingleton('customer/session')->getCustomer()->getFirstname();
- $lastName = (string)Mage::getSingleton('customer/session')->getCustomer()->getLastname();
- return $firstName.' '.$lastName;
+
+ return '';
}
+ /**
+ * Retrieve sender email address
+ *
+ * @return string
+ */
public function getEmail()
{
- if ($email = $this->getFormData()->getData('sender/email')) {
- return $email;
+ $email = $this->getFormData()->getData('sender/email');
+ if (!empty($email)) {
+ return trim($email);
+ }
+
+ /* @var $session Mage_Customer_Model_Session */
+ $session = Mage::getSingleton('customer/session');
+
+ if ($session->isLoggedIn()) {
+ return $session->getCustomer()->getEmail();
}
- return (string) Mage::getSingleton('customer/session')->getCustomer()->getEmail();
+
+ return '';
}
+ /**
+ * Retrieve Message text
+ *
+ * @return string
+ */
+ public function getMessage()
+ {
+ return $this->getFormData()->getData('sender/message');
+ }
+
+ /**
+ * Retrieve Form data or empty Varien_Object
+ *
+ * @return Varien_Object
+ */
public function getFormData()
{
$data = $this->getData('form_data');
- if (is_null($data)) {
- $data = new Varien_Object(Mage::getSingleton('catalog/session')->getFormData(true));
- $this->setFormData($data);
+ if (!$data instanceof Varien_Object) {
+ $data = new Varien_Object();
+ $this->setData('form_data', $data);
}
+
return $data;
}
+ /**
+ * Set Form data array
+ *
+ * @param array $data
+ * @return Mage_Sendfriend_Block_Send
+ */
+ public function setFormData($data)
+ {
+ if (is_array($data)) {
+ $this->setData('form_data', new Varien_Object($data));
+ }
+
+ return $this;
+ }
+
+ /**
+ * Retrieve Current Product Id
+ *
+ * @return int
+ */
public function getProductId()
{
- return $this->getRequest()->getParam('id');
+ return $this->getRequest()->getParam('id', null);
}
+ /**
+ * Retrieve current category id for product
+ *
+ * @return int
+ */
public function getCategoryId()
{
return $this->getRequest()->getParam('cat_id', null);
}
- public function getMaxRecipients()
- {
- $sendToFriendModel = Mage::registry('send_to_friend_model');
- return $sendToFriendModel->getMaxRecipients();
- }
-}
\ No newline at end of file
+ /**
+ * Retrieve Max Recipients
+ *
+ * @return int
+ */
+ public function getMaxRecipients()
+ {
+ return Mage::helper('sendfriend')->getMaxRecipients();
+ }
+
+ /**
+ * Retrieve Send URL for Form Action
+ *
+ * @return string
+ */
+ public function getSendUrl()
+ {
+ return Mage::getUrl('*/*/sendmail', array(
+ 'id' => $this->getProductId(),
+ 'cat_id' => $this->getCategoryId()
+ ));
+ }
+}
diff --git a/app/code/core/Mage/Sendfriend/Helper/Data.php b/app/code/core/Mage/Sendfriend/Helper/Data.php
index edf127f8a4..1328ad3da7 100644
--- a/app/code/core/Mage/Sendfriend/Helper/Data.php
+++ b/app/code/core/Mage/Sendfriend/Helper/Data.php
@@ -18,13 +18,118 @@
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ * @category Mage
+ * @package Mage_Sedfriend
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+
+/**
+ * Sendfriend Data Helper
+ *
+ * @category Mage
+ * @package Mage_Sedfriend
+ * @author Magento Core Team
+ */
class Mage_Sendfriend_Helper_Data extends Mage_Core_Helper_Abstract
{
+ const XML_PATH_ENABLED = 'sendfriend/email/enabled';
+ const XML_PATH_ALLOW_FOR_GUEST = 'sendfriend/email/allow_guest';
+ const XML_PATH_MAX_RECIPIENTS = 'sendfriend/email/max_recipients';
+ const XML_PATH_MAX_PER_HOUR = 'sendfriend/email/max_per_hour';
+ const XML_PATH_LIMIT_BY = 'sendfriend/email/check_by';
+ const XML_PATH_EMAIL_TEMPLATE = 'sendfriend/email/template';
+
+ const COOKIE_NAME = 'stf';
+
+ const CHECK_IP = 1;
+ const CHECK_COOKIE = 0;
+
+ /**
+ * Check is enabled Module
+ *
+ * @param int $store
+ * @return bool
+ */
+ public function isEnabled($store = null)
+ {
+ return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $store);
+ }
+
+ /**
+ * Check allow send email for guest
+ *
+ * @param int $store
+ * @return bool
+ */
+ public function isAllowForGuest($store = null)
+ {
+ return Mage::getStoreConfigFlag(self::XML_PATH_ALLOW_FOR_GUEST, $store);
+ }
+
+ /**
+ * Retrieve Max Recipients
+ *
+ * @param int $store
+ * @return int
+ */
+ public function getMaxRecipients($store = null)
+ {
+ return (int)Mage::getStoreConfig(self::XML_PATH_MAX_RECIPIENTS, $store);
+ }
+
+ /**
+ * Retrieve Max Products Sent in 1 Hour
+ *
+ * @param int $store
+ * @return int
+ */
+ public function getMaxEmailPerPeriod($store = null)
+ {
+ return (int)Mage::getStoreConfig(self::XML_PATH_MAX_PER_HOUR, $store);
+ }
+
+ /**
+ * Retrieve Limitation Period in seconds (1 hour)
+ *
+ * @return int
+ */
+ public function getPeriod()
+ {
+ return 3600;
+ }
+
+ /**
+ * Retrieve Limit Sending By
+ *
+ * @param int $store
+ * @return int
+ */
+ public function getLimitBy($store = null)
+ {
+ return (int)Mage::getStoreConfig(self::XML_PATH_LIMIT_BY, $store);
+ }
+
+ /**
+ * Retrieve Email Template
+ *
+ * @param int $store
+ * @return mixed
+ */
+ public function getEmailTemplate($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_EMAIL_TEMPLATE, $store);
+ }
+ /**
+ * Retrieve Key Name for Cookie
+ *
+ * @see self::COOKIE_NAME
+ * @return string
+ */
+ public function getCookieName()
+ {
+ return self::COOKIE_NAME;
+ }
}
diff --git a/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend.php b/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend.php
index b06ffb263a..a81ca34c32 100644
--- a/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend.php
+++ b/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend.php
@@ -18,36 +18,63 @@
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
- * @category Mage
- * @package Mage_Sendfriend
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ * @category Mage
+ * @package Mage_Sendfriend
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+
+/**
+ * SendFriend Log Resource Model
+ *
+ * @category Mage
+ * @package Mage_Sendfriend
+ * @author Magento Core Team
+ */
class Mage_Sendfriend_Model_Mysql4_Sendfriend extends Mage_Core_Model_Mysql4_Abstract
{
+ /**
+ * Initialize connection and table
+ *
+ */
protected function _construct()
{
$this->_init('sendfriend/sendfriend', 'log_id');
}
- public function getSendCount($model, $ip, $startTime)
+ /**
+ * Retrieve Sended Emails By Ip
+ *
+ * @param Mage_Sendfriend_Model_Sendfriend $object
+ * @param int $ip
+ * @param int $startTime
+ * @return int
+ */
+ public function getSendCount($object, $ip, $startTime)
{
$select = $this->_getReadAdapter()->select()
- ->from(array('main_table' => $this->getTable('sendfriend')), new Zend_Db_Expr('count(*)'))
- ->where('main_table.ip = ?', $ip)
- ->where('main_table.time >= ?', $startTime);
+ ->from(
+ array('main_table' => $this->getTable('sendfriend')),
+ array('count' => new Zend_Db_Expr('count(*)')))
+ ->where('ip=?', $ip)
+ ->where('time>=?', $startTime);
- $data = $this->_getReadAdapter()->fetchRow($select);
-
- return $data['count(*)'];
+ $row = $this->_getReadAdapter()->fetchRow($select);
+ return $row['count'];
}
- public function deleteLogsBefore($time)
- {
- $deleted = $this->_getWriteAdapter()
- ->delete($this->getTable('sendfriend'), $this->_getWriteAdapter()->quoteInto('time < ?', $time));
+ /**
+ * Delete Old logs
+ *
+ * @param int $time
+ * @return Mage_Sendfriend_Model_Mysql4_Sendfriend
+ */
+ public function deleteLogsBefore($time)
+ {
+ $cond = $this->_getWriteAdapter()->quoteInto('time', $time);
+ $this->_getWriteAdapter()->delete($this->getMainTable(), $cond);
return $this;
- }
-}
\ No newline at end of file
+ }
+}
diff --git a/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend/Collection.php b/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend/Collection.php
index 743333ff58..383d04007d 100644
--- a/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend/Collection.php
+++ b/app/code/core/Mage/Sendfriend/Model/Mysql4/Sendfriend/Collection.php
@@ -18,16 +18,28 @@
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
- * @category Mage
- * @package Mage_Sendfriend
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ * @category Mage
+ * @package Mage_Sendfriend
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+
+/**
+ * Sendfriend log resource collection
+ *
+ * @category Mage
+ * @package Mage_Sendfriend
+ * @author Magento Core Team
+ */
class Mage_Sendfriend_Model_Mysql4_Sendfriend_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
{
- protected function _construct()
- {
- $this->_init('sendfriend/sendfriend');
- }
-}
\ No newline at end of file
+ /**
+ * Init resource collection
+ *
+ */
+ protected function _construct()
+ {
+ $this->_init('sendfriend/sendfriend');
+ }
+}
diff --git a/app/code/core/Mage/Sendfriend/Model/Mysql4/Setup.php b/app/code/core/Mage/Sendfriend/Model/Mysql4/Setup.php
index 6df2bb5d79..47df5c4196 100644
--- a/app/code/core/Mage/Sendfriend/Model/Mysql4/Setup.php
+++ b/app/code/core/Mage/Sendfriend/Model/Mysql4/Setup.php
@@ -18,12 +18,20 @@
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
- * @category Mage
- * @package Mage_Sendfriend
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ * @category Mage
+ * @package Mage_Sendfriend
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+
+/**
+ * Sendfriend module Setup Model
+ *
+ * @category Mage
+ * @package Mage_Sendfriend
+ * @author Magento Core Team
+ */
class Mage_Sendfriend_Model_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
{
}
diff --git a/app/code/core/Mage/Sendfriend/Model/Observer.php b/app/code/core/Mage/Sendfriend/Model/Observer.php
new file mode 100644
index 0000000000..2892c5df0b
--- /dev/null
+++ b/app/code/core/Mage/Sendfriend/Model/Observer.php
@@ -0,0 +1,48 @@
+
+ */
+class Mage_Sendfriend_Model_Observer
+{
+ /**
+ * Register Sendfriend Model in global registry
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Sendfriend_Model_Observer
+ */
+ public function register(Varien_Event_Observer $observer)
+ {
+ Mage::getModel('sendfriend/sendfriend')->register();
+ return $this;
+ }
+}
diff --git a/app/code/core/Mage/Sendfriend/Model/Sendfriend.php b/app/code/core/Mage/Sendfriend/Model/Sendfriend.php
index ff3a980464..530e0bd899 100644
--- a/app/code/core/Mage/Sendfriend/Model/Sendfriend.php
+++ b/app/code/core/Mage/Sendfriend/Model/Sendfriend.php
@@ -27,69 +27,100 @@
class Mage_Sendfriend_Model_Sendfriend extends Mage_Core_Model_Abstract
{
/**
- * XML configuration paths
+ * Recipient Names
+ *
+ * @var array
*/
- const XML_PATH_SENDFRIEND_EMAIL_TEMPLATE = 'sendfriend/email/template';
+ protected $_names = array();
- protected $_names = array();
- protected $_emails = array();
- protected $_sender = array();
- protected $_ip = 0;
- protected $_product = null;
+ /**
+ * Recipient Emails
+ *
+ * @var array
+ */
+ protected $_emails = array();
- protected $_period = 3600; // hour
+ /**
+ * Sender data array
+ *
+ * @var array
+ */
+ protected $_sender = array();
- protected $_cookieName = 'stf';
+ /**
+ * Product Instance
+ *
+ * @var Mage_Catalog_Model_Product
+ */
+ protected $_product;
+ /**
+ * Initialize resource model
+ *
+ */
protected function _construct()
{
$this->_init('sendfriend/sendfriend');
}
- public function toOptionArray()
+ /**
+ * Retrieve Data Helper
+ *
+ * @return Mage_Sendfriend_Helper_Data
+ */
+ protected function _getHelper()
{
- if(!$collection = Mage::registry('config_system_email_template')) {
- $collection = Mage::getResourceModel('core/email_template_collection')
- ->load();
+ return Mage::helper('sendfriend');
+ }
- Mage::register('config_system_email_template', $collection);
- }
- $options = $collection->toOptionArray();
- array_unshift($options, array('value'=>'', 'label'=>''));
- return $options;
+ /**
+ * Retrieve Option Array
+ *
+ * @deprecated It Is a not Source model
+ * @return array
+ */
+ public function toOptionArray()
+ {
+ return array();
}
public function send()
{
- $translate = Mage::getSingleton('core/translate');
/* @var $translate Mage_Core_Model_Translate */
+ $translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
- $errors = array();
+ /* @var $mailTemplate Mage_Core_Model_Email_Template */
+ $mailTemplate = Mage::getModel('core/email_template');
- $this->_emailModel = Mage::getModel('core/email_template');
- $message = nl2br(htmlspecialchars($this->_sender['message']));
+ $message = nl2br(htmlspecialchars($this->getSender()->getMessage()));
$sender = array(
- 'name' => strip_tags($this->_sender['name']),
- 'email' => strip_tags($this->_sender['email'])
- );
-
- foreach($this->_emails as $key => $email) {
- $this->_emailModel->setDesignConfig(array('area'=>'frontend', 'store'=>$this->getStoreId()))
- ->sendTransactional(
- Mage::getStoreConfig(self::XML_PATH_SENDFRIEND_EMAIL_TEMPLATE),
+ 'name' => $this->_getHelper()->htmlEscape($this->getSender()->getName()),
+ 'email' => $this->_getHelper()->htmlEscape($this->getSender()->getEmail())
+ );
+
+ $mailTemplate->setDesignConfig(array(
+ 'area' => 'frontend',
+ 'store' => Mage::app()->getStore()->getId()
+ ));
+
+ foreach ($this->getRecipients()->getEmails() as $k => $email) {
+ $name = $this->getRecipients()->getNames($k);
+ $mailTemplate->sendTransactional(
+ $this->getTemplate(),
$sender,
$email,
- $this->_names[$key],
+ $name,
array(
- 'name' => $this->_names[$key],
+ 'name' => $name,
'email' => $email,
- 'product_name' => $this->_product->getName(),
- 'product_url' => $this->_product->getProductUrl(),
+ 'product_name' => $this->getProduct()->getName(),
+ 'product_url' => $this->getProduct()->getUrlInStore(),
'message' => $message,
- 'sender_name' => strip_tags($this->_sender['name']),
- 'sender_email' => strip_tags($this->_sender['email']),
- 'product_image' => Mage::helper('catalog/image')->init($this->_product, 'small_image')->resize(75),
+ 'sender_name' => $sender['name'],
+ 'sender_email' => $sender['email'],
+ 'product_image' => Mage::helper('catalog/image')->init($this->getProduct(),
+ 'small_image')->resize(75),
)
);
}
@@ -99,87 +130,246 @@ public function send()
return $this;
}
+ /**
+ * Validate Form data
+ *
+ * @return bool|array
+ */
public function validate()
{
$errors = array();
- $helper = Mage::helper('sendfriend');
- if (empty($this->_sender['name'])) {
- $errors[] = $helper->__('Sender name can\'t be empty');
+ $name = $this->getSender()->getName();
+ if (empty($name)) {
+ $errors[] = Mage::helper('sendfriend')->__('Sender name can\'t be empty');
+ }
+
+ $email = $this->getSender()->getEmail();
+ if (empty($email) OR !Zend_Validate::is($email, 'EmailAddress')) {
+ $errors[] = Mage::helper('sendfriend')->__('Invalid sender email');
}
- if (!isset($this->_sender['email']) || !Zend_Validate::is($this->_sender['email'], 'EmailAddress')) {
- $errors[] = $helper->__('Invalid sender email');
+ $message = $this->getSender()->getMessage();
+ if (empty($message)) {
+ $errors[] = Mage::helper('sendfriend')->__('Message can\'t be empty');
}
- if (empty($this->_sender['message'])) {
- $errors[] = $helper->__('Message can\'t be empty');
+ if (!$this->getRecipients()->getEmails()) {
+ $errors[] = Mage::helper('sendfriend')->__('You have to specify at least one recipient');
}
- foreach ($this->_emails as $email) {
+ // validate recipients email addresses
+ foreach ($this->getRecipients()->getEmails() as $email) {
if (!Zend_Validate::is($email, 'EmailAddress')) {
- $errors[] = $helper->__('You input invalid email address for recipient');
+ $errors[] = Mage::helper('sendfriend')->__('You input invalid email address for recipient');
break;
}
}
- if (!$this->canEmailToFriend()) {
- $errors[] = $helper->__('You cannot email this product to a friend');
- }
+ switch ($this->_getHelper()->getLimitBy()) {
+ case Mage_Sendfriend_Helper_Data::CHECK_COOKIE:
+ $amount = $this->_amountByCookies();
+ break;
- if ($this->_getSendToFriendCheckType()) {
- $amount = $this->_amountByCookies();
- } else {
- $amount = $this->_amountByIp();
+ case Mage_Sendfriend_Helper_Data::CHECK_IP:
+ $amount = $this->_amountByIp();
+ break;
+ default:
+ $amount = 0;
+ break;
}
if ($amount >= $this->getMaxSendsToFriend()){
- $errors[] = $helper->__('You have exceeded limit of %d sends in an hour', $this->getMaxSendsToFriend());
+ $errors[] = Mage::helper('sendfriend')->__('You have exceeded limit of %d sends in an hour', $this->getMaxSendsToFriend());
}
$maxRecipients = $this->getMaxRecipients();
- if (count($this->_emails) > $maxRecipients) {
- $errors[] = $helper->__('You cannot send more than %d emails at a time', $this->getMaxRecipients());
+ if (count($this->getRecipients()->getEmails()) > $maxRecipients) {
+ $errors[] = Mage::helper('sendfriend')->__('You cannot send more than %d emails at a time', $this->getMaxRecipients());
}
- if (count($this->_emails) < 1) {
- $errors[] = $helper->__('You have to specify at least one recipient');
+ if (empty($errors)) {
+ return true;
}
- if (!$this->getTemplate()){
- $errors[] = $helper->__('Email template is not specified by administrator');
- }
+ return $errors;
+ }
+ /**
+ * Set cookie instance
+ *
+ * @param Mage_Core_Model_Cookie $product
+ * @return Mage_Sendfriend_Model_Sendfriend
+ */
+ public function setCookie($cookie)
+ {
+ return $this->setData('_cookie', $cookie);
+ }
- if (empty($errors)) {
- return true;
+ /**
+ * Retrieve Cookie instance
+ *
+ * @throws Mage_Core_Exception
+ * @return Mage_Core_Model_Cookie
+ */
+ public function getCookie()
+ {
+ $cookie = $this->_getData('_cookie');
+ if (!$cookie instanceof Mage_Core_Model_Cookie) {
+ Mage::throwException(Mage::helper('sendfriend')->__('Please define correct Cookie instance'));
}
- return $errors;
+ return $cookie;
}
- public function setIp($ip)
+ /**
+ * Set Visitor Remote Address
+ *
+ * @param int $ipAddr the IP address on Long Format
+ * @return Mage_Sendfriend_Model_Sendfriend
+ */
+ public function setRemoteAddr($ipAddr)
{
- $this->_ip = $ip;
+ Mage::log(array(__METHOD__, $ipAddr));
+ $this->setData('_remote_addr', $ipAddr);
+ return $this;
}
+ /**
+ * Retrieve Visitor Remote Address
+ *
+ * @return int
+ */
+ public function getRemoteAddr()
+ {
+ Mage::log(array(__METHOD__, $this->_getData('_remote_addr')));
+ return $this->_getData('_remote_addr');
+ }
+
+ /**
+ * Set Recipients
+ *
+ * @param array $recipients
+ * @return Mage_Sendfriend_Model_Sendfriend
+ */
public function setRecipients($recipients)
{
- $this->_emails = array_unique($recipients['email']);
- $this->_names = $recipients['name'];
+ // validate array
+ if (!is_array($recipients) OR !isset($recipients['email'])
+ OR !isset($recipients['name']) OR !is_array($recipients['email'])
+ OR !is_array($recipients['name'])) {
+ return $this;
+ }
+
+ $emails = array();
+ $names = array();
+ foreach ($recipients['email'] as $k => $email) {
+ if (!isset($emails[$email]) && isset($recipients['name'][$k])) {
+ $emails[$email] = true;
+ $names[] = $recipients['name'][$k];
+ }
+ }
+
+ if ($emails) {
+ $emails = array_keys($emails);
+ }
+
+ return $this->setData('_recipients', new Varien_Object(array(
+ 'emails' => $emails,
+ 'names' => $names
+ )));
+ }
+
+ /**
+ * Retrieve Recipients object
+ *
+ * @return Varien_Object
+ */
+ public function getRecipients()
+ {
+ $recipients = $this->_getData('_recipients');
+ if (!$recipients instanceof Varien_Object) {
+ $recipients = new Varien_Object(array(
+ 'emails' => array(),
+ 'names' => array()
+ ));
+ $this->setData('_recipients', $recipients);
+ }
+ return $recipients;
}
- public function setProduct($product){
- $this->_product = $product;
+ /**
+ * Set product instance
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @return Mage_Sendfriend_Model_Sendfriend
+ */
+ public function setProduct($product)
+ {
+ return $this->setData('_product', $product);
+ }
+
+ /**
+ * Retrieve Product instance
+ *
+ * @throws Mage_Core_Exception
+ * @return Mage_Catalog_Model_Product
+ */
+ public function getProduct()
+ {
+ $product = $this->_getData('_product');
+ if (!$product instanceof Mage_Catalog_Model_Product) {
+ Mage::throwException(Mage::helper('sendfriend')->__('Please define correct Product instance'));
+ }
+ return $product;
+ }
+
+ /**
+ * Set Sender Information array
+ *
+ * @param array $sender
+ * @return Mage_Sendfriend_Model_Sendfriend
+ */
+ public function setSender($sender)
+ {
+ if (!is_array($sender)) {
+ Mage::helper('sendfriend')->__('Invalid Sender information');
+ }
+
+ return $this->setData('_sender', new Varien_Object($sender));
}
- public function setSender($sender){
- $this->_sender = $sender;
+ /**
+ * Retrieve Sender Information Object
+ *
+ * @throws Mage_Core_Exception
+ * @return Varien_Object
+ */
+ public function getSender()
+ {
+ $sender = $this->_getData('_sender');
+ if (!$sender instanceof Varien_Object) {
+ Mage::throwException(Mage::helper('sendfriend')->__('Please define correct Sender information'));
+ }
+ return $sender;
}
- public function getSendCount($ip, $startTime)
+ /**
+ * Retrieve Send count by IP
+ *
+ * @param int $ip
+ * @param int $startTime
+ * @return int
+ */
+ public function getSendCount($ip = null, $startTime = null)
{
- $count = $this->_getResource()->getSendCount($this, $ip, $startTime);
- return $count;
+ if (is_null($ip)) {
+ $ip = $this->getRemoteAddr();
+ }
+ if (is_null($startTime)) {
+ $startTime = time() - $this->_getHelper()->getPeriod();
+ }
+
+ return $this->_getResource()->getSendCount($this, $ip, $startTime);
}
/**
@@ -189,17 +379,17 @@ public function getSendCount($ip, $startTime)
*/
public function getMaxSendsToFriend()
{
- return max(0, (int) Mage::getStoreConfig('sendfriend/email/max_per_hour'));
+ return $this->_getHelper()->getMaxEmailPerPeriod();
}
/**
- * Get current "Send to friend" template
+ * Get current Email "Send to friend" template
*
* @return string
*/
public function getTemplate()
{
- return Mage::getStoreConfig('sendfriend/email/template');
+ return $this->_getHelper()->getEmailTemplate();
}
/**
@@ -209,7 +399,7 @@ public function getTemplate()
*/
public function getMaxRecipients()
{
- return max(0, (int) Mage::getStoreConfig('sendfriend/email/max_recipients'));
+ return $this->_getHelper()->getMaxRecipients();
}
/**
@@ -219,84 +409,63 @@ public function getMaxRecipients()
*/
public function canEmailToFriend()
{
- if (!Mage::getStoreConfig('sendfriend/email/enabled')) {
- return false;
- }
- if (!Mage::getStoreConfig('sendfriend/email/allow_guest')
- && !Mage::getSingleton('customer/session')->isLoggedIn()) {
- return false;
- }
- return true;
- }
-
- /**
- * Get check type for "Send to Friend" function
- *
- * @return integer
- */
- private function _getSendToFriendCheckType()
- {
- return max(0, (int) Mage::getStoreConfig('sendfriend/email/check_by'));
+ return $this->_getHelper()->isEnabled();
}
/**
* Retrieve amount by cookie
+ *
* @return int
*/
- private function _amountByCookies()
+ protected function _amountByCookies()
{
+ $cookie = $this->_getHelper()->getCookieName();
+ $time = time();
$newTimes = array();
- $oldTimes = Mage::app()->getCookie()
- ->get($this->_cookieName);
- if ($oldTimes){
+ $oldTimes = $this->getCookie()->get($cookie);
+ if ($oldTimes) {
$oldTimes = explode(',', $oldTimes);
- foreach ($oldTimes as $time){
- if (is_numeric($time) && $time >= time()-$this->_period){
- $newTimes[] = $time;
+ foreach ($oldTimes as $oldTime) {
+ $periodTime = $time - $this->_getHelper()->getPeriod();
+ if (is_numeric($oldTime) AND $oldTime >= $periodTime) {
+ $newTimes[] = $oldTime;
}
}
}
+
$amount = count($newTimes);
+ $newTimes[] = $time;
- $newTimes[] = time();
- Mage::app()->getCookie()
- ->set($this->_cookieName, implode(',', $newTimes), $this->_period);
+ $this->getCookie()->set($cookie, implode(',', $newTimes));
return $amount;
}
/**
* Retrieve amount by IP address
- *
+ *
* @return int
*/
- private function _amountByIp()
+ protected function _amountByIp()
{
- $this->_deleteLogsBefore(time() - $this->_period);
+ $time = time();
+ $period = $this->_getHelper()->getPeriod();
+
+ // delete expired logs
+ $this->_getResource()->deleteLogsBefore($time - $period);
$amount = $this->getSendCount($this->_ip, time() - $this->_period);
- $this->setData(array('ip'=>$this->_ip, 'time'=>time()));
- $this->save();
+ $this->setIp($this->getRemoteAddr())
+ ->setTime($time)
+ ->save();
return $amount;
}
/**
- * Delete Before Log
- *
- * @param int $time
- * @return Mage_Sendfriend_Model_Sendfriend
- */
- private function _deleteLogsBefore($time)
- {
- $this->_getResource()->deleteLogsBefore($time);
- return $this;
- }
-
- /**
- * Check and register object
- *
+ * Register self in global register with name send_to_friend_model
+ *
* @return Mage_Sendfriend_Model_Sendfriend
*/
public function register()
@@ -306,4 +475,4 @@ public function register()
}
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Sendfriend/controllers/ProductController.php b/app/code/core/Mage/Sendfriend/controllers/ProductController.php
index 5c09575199..32e08876ba 100644
--- a/app/code/core/Mage/Sendfriend/controllers/ProductController.php
+++ b/app/code/core/Mage/Sendfriend/controllers/ProductController.php
@@ -24,24 +24,66 @@
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+/**
+ * Email to a Friend Product Controller
+ *
+ * @category Mage
+ * @package Mage_Sedfriend
+ * @author Magento Core Team
+ */
class Mage_Sendfriend_ProductController extends Mage_Core_Controller_Front_Action
{
/**
- * Initialize product instance
+ * Predispatch: check is enable module
+ * If allow only for customer - redirect to login page
+ *
+ * @return Mage_Sendfriend_ProductController
+ */
+ public function preDispatch()
+ {
+ parent::preDispatch();
+
+ /* @var $helper Mage_Sendfriend_Helper_Data */
+ $helper = Mage::helper('sendfriend');
+ /* @var $session Mage_Customer_Model_Session */
+ $session = Mage::getSingleton('customer/session');
+
+ if (!$helper->isEnabled()) {
+ $this->_forward('noRoute');
+ return $this;
+ }
+
+ if (!$helper->isAllowForGuest() && !$session->authenticate($this)) {
+ $this->setFlag('', self::FLAG_NO_DISPATCH, true);
+ if ($this->getRequest()->getActionName() == 'sendemail') {
+ $session->setBeforeAuthUrl(Mage::getUrl('*/*/send', array(
+ '_current' => true
+ )));
+ Mage::getSingleton('catalog/session')
+ ->setSendfriendFormData($this->getRequest()->getPost());
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Initialize Product Instance
*
* @return Mage_Catalog_Model_Product
*/
protected function _initProduct()
{
- $productId = (int) $this->getRequest()->getParam('id');
+ $productId = (int)$this->getRequest()->getParam('id');
if (!$productId) {
return false;
}
$product = Mage::getModel('catalog/product')
->load($productId);
- if (!$product->getId()) {
+ if (!$product->getId() || !$product->isVisibleInCatalog()) {
return false;
}
+
Mage::register('product', $product);
return $product;
}
@@ -51,94 +93,114 @@ protected function _initProduct()
*
* @return Mage_Sendfriend_Model_Sendfriend
*/
- protected function _initSendToFriendModel(){
- $sendToFriendModel = Mage::getModel('sendfriend/sendfriend');
- Mage::register('send_to_friend_model', $sendToFriendModel);
- return $sendToFriendModel;
- }
+ protected function _initSendToFriendModel()
+ {
+ $model = Mage::getModel('sendfriend/sendfriend');
+ $model->setRemoteAddr(Mage::helper('core/http')->getRemoteAddr(true));
+ $model->setCookie(Mage::app()->getCookie());
- public function sendAction(){
- $product = $this->_initProduct();
- $this->_initSendToFriendModel();
+ Mage::register('send_to_friend_model', $model);
- if (!$product || !$product->isVisibleInCatalog()) {
- $this->_forward('noRoute');
- return;
- }
+ return $model;
+ }
- $productHelper = Mage::helper('catalog/product');
- $sendToFriendModel = Mage::registry('send_to_friend_model');
+ /**
+ * Show Send to a Friend Form
+ *
+ */
+ public function sendAction()
+ {
+ $product = $this->_initProduct();
+ $model = $this->_initSendToFriendModel();
- /**
- * check if user is allowed to send product to a friend
- */
- if (!$sendToFriendModel->canEmailToFriend()) {
- Mage::getSingleton('catalog/session')->addError(
- $this->__('You cannot email this product to a friend')
- );
- $this->_redirectReferer($product->getProductUrl());
+ if (!$product) {
+ $this->_forward('noRoute');
return;
}
- $maxSendsToFriend = $sendToFriendModel->getMaxSendsToFriend();
- if ($maxSendsToFriend){
+ if ($model->getMaxSendsToFriend()) {
Mage::getSingleton('catalog/session')->addNotice(
- $this->__('You cannot send more than %d times in an hour', $maxSendsToFriend)
+ $this->__('You cannot send more than %d times in an hour', $model->getMaxSendsToFriend())
);
}
$this->loadLayout();
$this->_initLayoutMessages('catalog/session');
+
+ Mage::dispatchEvent('sendfriend_product', array('product' => $product));
+ $data = Mage::getSingleton('catalog/session')->getSendfriendFormData();
+ if ($data) {
+ Mage::getSingleton('catalog/session')->setSendfriendFormData(true);
+ $block = $this->getLayout()->getBlock('sendfriend.send');
+ if ($block) {
+ $block->setFormData($data);
+ }
+ }
+
$this->renderLayout();
- Mage::dispatchEvent('sendfriend_product', array('product'=>$product));
}
+ /**
+ * Send Email Post Action
+ *
+ */
public function sendmailAction()
{
- $product = $this->_initProduct();
- $sendToFriendModel = $this->_initSendToFriendModel();
- $data = $this->getRequest()->getPost();
+ if (!$this->_validateFormKey()) {
+ return $this->_redirect('*/*/send', array('_current' => true));
+ }
- if (!$product || !$product->isVisibleInCatalog() || !$data) {
+ $product = $this->_initProduct();
+ $model = $this->_initSendToFriendModel();
+ $data = $this->getRequest()->getPost();
+
+ if (!$product || !$data) {
$this->_forward('noRoute');
return;
}
$categoryId = $this->getRequest()->getParam('cat_id', null);
- if ($categoryId && $category = Mage::getModel('catalog/category')->load($categoryId)) {
+ if ($categoryId) {
+ $category = Mage::getModel('catalog/category')
+ ->load($categoryId);
+ $product->setCategory($category);
Mage::register('current_category', $category);
}
- $sendToFriendModel->setSender($this->getRequest()->getPost('sender'));
- $sendToFriendModel->setRecipients($this->getRequest()->getPost('recipients'));
- $sendToFriendModel->setIp(Mage::getSingleton('log/visitor')->getRemoteAddr());
- $sendToFriendModel->setProduct($product);
+ $model->setSender($this->getRequest()->getPost('sender'));
+ $model->setRecipients($this->getRequest()->getPost('recipients'));
+ $model->setProduct($product);
try {
- $validateRes = $sendToFriendModel->validate();
- if (true === $validateRes) {
- $sendToFriendModel->send();
+ $validate = $model->validate();
+ if ($validate === true) {
+ $model->send();
Mage::getSingleton('catalog/session')->addSuccess($this->__('Link to a friend was sent.'));
$this->_redirectSuccess($product->getProductUrl());
return;
}
else {
- Mage::getSingleton('catalog/session')->setFormData($data);
- if (is_array($validateRes)) {
- foreach ($validateRes as $errorMessage) {
- Mage::getSingleton('catalog/session')->addError($errorMessage);
+ if (is_array($validate)) {
+ foreach ($validate as $errorMessage) {
+ Mage::getSingleton('catalog/session')->addError($errorMessage);
}
- } else {
+ }
+ else {
Mage::getSingleton('catalog/session')->addError($this->__('Some problems with data.'));
}
}
- } catch (Mage_Core_Exception $e) {
+ }
+ catch (Mage_Core_Exception $e) {
Mage::getSingleton('catalog/session')->addError($e->getMessage());
- } catch (Exception $e) {
+ }
+ catch (Exception $e) {
Mage::getSingleton('catalog/session')
->addException($e, $this->__('Some emails was not sent'));
}
- $this->_redirectError(Mage::getURL('*/*/send',array('id'=>$product->getId())));
+ // save form data
+ Mage::getSingleton('catalog/session')->setSendfriendFormData($data);
+
+ $this->_redirectError(Mage::getURL('*/*/send', array('_current' => true)));
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Sendfriend/etc/config.xml b/app/code/core/Mage/Sendfriend/etc/config.xml
index 156b2db85b..255e62463e 100644
--- a/app/code/core/Mage/Sendfriend/etc/config.xml
+++ b/app/code/core/Mage/Sendfriend/etc/config.xml
@@ -26,52 +26,52 @@
*/
-->
-
-
- 0.7.2
-
-
-
-
-
- Mage_Sendfriend_Model
- sendfriend_mysql4
-
-
- Mage_Sendfriend_Model_Mysql4
- sendfriend_mysql4
-
-
-
-
-
-
-
-
-
-
- Mage_Sendfriend
- Mage_Sendfriend_Model_Mysql4_Setup
-
-
- core_setup
-
-
-
-
- core_write
-
-
-
-
- core_read
-
-
-
-
- Mage_Sendfriend_Block
-
-
+
+
+ 0.7.3
+
+
+
+
+
+ Mage_Sendfriend_Model
+ sendfriend_mysql4
+
+
+ Mage_Sendfriend_Model_Mysql4
+ sendfriend_mysql4
+
+
+
+
+
+
+
+
+
+
+ Mage_Sendfriend
+ Mage_Sendfriend_Model_Mysql4_Setup
+
+
+ core_setup
+
+
+
+
+ core_write
+
+
+
+
+ core_read
+
+
+
+
+ Mage_Sendfriend_Block
+
+
Send product to a friend
@@ -80,59 +80,59 @@
-
-
+
+
-
-
-
-
- Mage_Sendfriend.csv
-
-
-
-
+
+
+
+
+ Mage_Sendfriend.csv
+
+
+
+
-
+
-
-
-
-
- singleton
- sendfriend/sendfriend
- register
-
-
-
-
-
-
- standard
-
- Mage_Sendfriend
- sendfriend
-
-
-
-
-
-
- sendfriend.xml
-
-
-
-
-
-
-
- Mage_Sendfriend.csv
-
-
-
-
-
-
+
+
+
+
+ singleton
+ sendfriend/observer
+ register
+
+
+
+
+
+
+ standard
+
+ Mage_Sendfriend
+ sendfriend
+
+
+
+
+
+
+ sendfriend.xml
+
+
+
+
+
+
+
+ Mage_Sendfriend.csv
+
+
+
+
+
+
@@ -145,4 +145,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/core/Mage/Sendfriend/sql/sendfriend_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/Sendfriend/sql/sendfriend_setup/mysql4-upgrade-0.7.2-0.7.3.php
new file mode 100644
index 0000000000..db9e0d532d
--- /dev/null
+++ b/app/code/core/Mage/Sendfriend/sql/sendfriend_setup/mysql4-upgrade-0.7.2-0.7.3.php
@@ -0,0 +1,44 @@
+startSetup();
+$installer->getConnection()->dropKey($installer->getTable('sendfriend/sendfriend'), 'ip');
+$installer->getConnection()->dropKey($installer->getTable('sendfriend/sendfriend'), 'time');
+$installer->getConnection()->modifyColumn($installer->getTable('sendfriend/sendfriend'),
+ 'log_id', 'int(10) unsigned NOT NULL');
+$installer->getConnection()->modifyColumn($installer->getTable('sendfriend/sendfriend'),
+ 'ip', 'bigint(20) NOT NULL DEFAULT 0');
+$installer->getConnection()->modifyColumn($installer->getTable('sendfriend/sendfriend'),
+ 'time', 'int(10) unsigned NOT NULL');
+$installer->getConnection()->addKey($installer->getTable('sendfriend/sendfriend'),
+ 'IDX_REMOTE_ADDR', array('ip'));
+$installer->getConnection()->addKey($installer->getTable('sendfriend/sendfriend'),
+ 'IDX_LOG_TIME', array('time'));
+$installer->endSetup();
diff --git a/app/code/core/Mage/Shipping/Block/Tracking/Popup.php b/app/code/core/Mage/Shipping/Block/Tracking/Popup.php
index 7f86240ce6..51fdda5632 100644
--- a/app/code/core/Mage/Shipping/Block/Tracking/Popup.php
+++ b/app/code/core/Mage/Shipping/Block/Tracking/Popup.php
@@ -161,31 +161,46 @@ public function getTrackingInfoByTrackId()
return $shipTrack;
}
- /*
- * change date format to mm/dd/Y hh:mm AM/PM
- */
- public function formatDeliveryDateTime($date,$time)
+ /**
+ * Format given date and time in current locale without changing timezone
+ *
+ * @param string $date
+ * @param string $time
+ * @return string
+ */
+ public function formatDeliveryDateTime($date, $time)
{
- return Mage::app()->getLocale()->date(strtotime($date.' '.$time),Zend_Date::TIMESTAMP, null, false)->toString('MM/dd/YYYY hh:mm a');
+ return $this->formatDeliveryDate($date) . ' ' . $this->formatDeliveryTime($time);
}
- /*
- * change date format to mm/dd/Y
- */
+ /**
+ * Format given date in current locale without changing timezone
+ *
+ * @param string $date
+ * @return string
+ */
public function formatDeliveryDate($date)
{
- return Mage::app()->getLocale()->date(strtotime($date),Zend_Date::TIMESTAMP, null, false)->toString('MM/dd/YYYY');
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
+ return Mage::app()->getLocale()->date(strtotime($date), Zend_Date::TIMESTAMP, null, false)
+ ->toString($format);
}
- /*
- * change date format to mm/dd/Y
- */
+ /**
+ * Format given time [+ date] in current locale without changing timezone
+ *
+ * @param string $time
+ * @param string $date
+ * @return string
+ */
public function formatDeliveryTime($time, $date = null)
{
if (!empty($date)) {
- $time = $date.' '.$time;
+ $time = $date . ' ' . $time;
}
- return Mage::app()->getLocale()->date(strtotime($time),Zend_Date::TIMESTAMP, null, false)->toString('hh:mm a');
+ $format = Mage::app()->getLocale()->getTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
+ return Mage::app()->getLocale()->date(strtotime($time), Zend_Date::TIMESTAMP, null, false)
+ ->toString($format);
}
public function getStoreSupportEmail()
diff --git a/app/code/core/Mage/Shipping/Model/Carrier/Tablerate.php b/app/code/core/Mage/Shipping/Model/Carrier/Tablerate.php
index de1c31b268..fb6b8fa5e6 100644
--- a/app/code/core/Mage/Shipping/Model/Carrier/Tablerate.php
+++ b/app/code/core/Mage/Shipping/Model/Carrier/Tablerate.php
@@ -55,6 +55,24 @@ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
return false;
}
+ // exclude Virtual products price from Package value if pre-configured
+ if (!$this->getConfigFlag('include_virtual_price') && $request->getAllItems()) {
+ foreach ($request->getAllItems() as $item) {
+ if ($item->getParentItem()) {
+ continue;
+ }
+ if ($item->getHasChildren() && $item->isShipSeparately()) {
+ foreach ($item->getChildren() as $child) {
+ if ($child->getProduct()->isVirtual()) {
+ $request->setPackageValue($request->getPackageValue() - $child->getBaseRowTotal());
+ }
+ }
+ } elseif ($item->getProduct()->isVirtual()) {
+ $request->setPackageValue($request->getPackageValue() - $item->getBaseRowTotal());
+ }
+ }
+ }
+
if (!$request->getConditionName()) {
$request->setConditionName($this->getConfigData('condition_name') ? $this->getConfigData('condition_name') : $this->_default_condition_name);
}
diff --git a/app/code/core/Mage/Shipping/etc/config.xml b/app/code/core/Mage/Shipping/etc/config.xml
index 1da1e4053b..bfa648d7db 100644
--- a/app/code/core/Mage/Shipping/etc/config.xml
+++ b/app/code/core/Mage/Shipping/etc/config.xml
@@ -205,6 +205,7 @@
0
0
package_weight
+ 1
shipping/carrier_tablerate
Table Rate
Best Way
diff --git a/app/code/core/Mage/Shipping/etc/system.xml b/app/code/core/Mage/Shipping/etc/system.xml
index bba93d97b6..655880ee4f 100644
--- a/app/code/core/Mage/Shipping/etc/system.xml
+++ b/app/code/core/Mage/Shipping/etc/system.xml
@@ -361,6 +361,15 @@
1
0
+
+ Include Virtual products in Price calculation
+ select
+ adminhtml/system_config_source_yesno
+ 5
+ 1
+ 1
+ 1
+
Export
export
diff --git a/app/code/core/Mage/Strikeiron/Helper/Data.php b/app/code/core/Mage/Strikeiron/Helper/Data.php
new file mode 100644
index 0000000000..689409cb50
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Helper/Data.php
@@ -0,0 +1,38 @@
+
+ */
+class Mage_Strikeiron_Model_Currency_Import_Strikeiron extends Mage_Directory_Model_Currency_Import_Abstract
+{
+ protected $_messages = array();
+
+ public function fetchRates()
+ {
+ $data = array();
+ $currencies = $this->_getCurrencyCodes();
+ $defaultCurrencies = $this->_getDefaultCurrencyCodes();
+ try {
+ $strikeironModel = Mage::getModel('strikeiron/strikeiron');
+ foreach ($defaultCurrencies as $currencyFrom) {
+ $currenciesToArr = array();
+ if (!isset($data[$currencyFrom])) {
+ $data[$currencyFrom] = array();
+ }
+ foreach ($currencies as $currencyTo) {
+ if ($currencyFrom == $currencyTo) {
+ $data[$currencyFrom][$currencyTo] = $this->_numberFormat(1);
+ }
+ else {
+ $currenciesToArr[] = $currencyTo;
+ }
+ }
+ if ($currenciesToArr) {
+ $result = $strikeironModel->fetchExchangeRate($currencyFrom , $currenciesToArr);
+ if ($result) {
+ $data = array_merge_recursive($result, $data);
+ $convertedCurrencies = array();
+ foreach ($result[$currencyFrom] as $k => $r) {
+ $convertedCurrencies[] = $k;
+ }
+ $currenciesNotConverted = array_diff($currenciesToArr, $convertedCurrencies);
+ if ($currenciesNotConverted) {
+ foreach ($currenciesNotConverted as $_currencyNconvert) {
+ $this->_messages[] = Mage::helper('strikeiron')->__('%s is not supported currency.', $_currencyNconvert);
+ $data[$currencyFrom][$_currencyNconvert] = $this->_numberFormat(null);
+ }
+ }
+ } else {
+ $this->_messages[] = Mage::helper('strikeiron')->__('Cannot retreive rate from strikeirion.');
+ }
+ }
+ ksort($data[$currencyFrom]);
+ }
+ } catch (Exception $e) {
+ $this->_messages[] = $e->getMessage();
+ }
+ return $data;
+ }
+
+ protected function _convert($currencyFrom, $currencyTo, $retry=0)
+ {
+
+ try {
+ $strikeironModel = Mage::getModel('strikeiron/strikeiron');
+ $result = $strikeironModel->fetchExchangeRate($currencyFrom , array($currencyTo));
+ return $result;
+ }
+ catch (Exception $e) {
+ if( $retry == 0 ) {
+ $this->_convert($currencyFrom, $currencyTo, 1);
+ } else {
+ $this->_messages[] = Mage::helper('strikeiron')->__('Cannot retrieve rate from %s to %s', $currencyFrom, $currencyTo);
+ }
+ }
+
+ }
+
+
+}
diff --git a/app/code/core/Mage/Strikeiron/Model/Mysql4/Taxrate.php b/app/code/core/Mage/Strikeiron/Model/Mysql4/Taxrate.php
new file mode 100644
index 0000000000..98de4ffe69
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Mysql4/Taxrate.php
@@ -0,0 +1,106 @@
+
+ */
+
+class Mage_Strikeiron_Model_Mysql4_Taxrate extends Mage_Core_Model_Mysql4_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('strikeiron/tax_rate', 'tax_rate_id');
+ }
+
+ /**
+ * Initialize unique fields
+ *
+ * @return Mage_Core_Model_Mysql4_Abstract
+ */
+ protected function _initUniqueFields()
+ {
+ $this->_uniqueFields = array(array(
+ 'field' => array('tax_country_id', 'tax_region_id', 'tax_postcode'),
+ 'title' => Mage::helper('strikeiron')->__('Country/Region/Postal code combination'),
+ ));
+ return $this;
+ }
+
+ protected function _checkUnique(Mage_Core_Model_Abstract $object)
+ {
+ $existent = array();
+ $rateValueArray = array();
+ if (!empty($this->_uniqueFields)) {
+ if (!is_array($this->_uniqueFields)) {
+ $this->_uniqueFields = array(
+ array(
+ 'field' => $this->_uniqueFields,
+ 'title' => $this->_uniqueFields
+ ));
+ }
+
+ $data = new Varien_Object($this->_prepareDataForSave($object));
+ $select = $this->_getWriteAdapter()->select()
+ ->from($this->getMainTable());
+
+ foreach ($this->_uniqueFields as $unique) {
+ $select->reset(Zend_Db_Select::WHERE);
+
+ if (is_array($unique['field'])) {
+ foreach ($unique['field'] as $field) {
+ $select->where($field.'=?', $data->getData($field));
+ $rateValueArray[] = $this->_getWriteAdapter()->quoteInto($field.'=?', $data->getData($field));
+ }
+ }
+ else {
+ $select->where( $unique['field'] . ' = ?', $data->getData($unique['field']) );
+ $rateValueArray[] = $this->_getWriteAdapter()->quoteInto( $unique['field'] . ' = ?', $data->getData($unique['field']) );
+ }
+
+ if ($object->getId()) {
+ $select->where($this->getIdFieldName().' != ?', $object->getId());
+ }
+
+ if ( $test = $this->_getWriteAdapter()->fetchRow($select) ) {
+ $existent[] = $test['tax_rate_id'];
+ }
+ }
+ }
+ if (!empty($existent)) {
+ $this->_getWriteAdapter()->delete($this->getMainTable(), $rateValueArray);
+ }
+
+ }
+
+ public function deleteAllRates()
+ {
+ $this->_getWriteAdapter()->delete($this->getMainTable());
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Mysql4/Taxrate/Collection.php b/app/code/core/Mage/Strikeiron/Model/Mysql4/Taxrate/Collection.php
new file mode 100644
index 0000000000..96120f2b8d
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Mysql4/Taxrate/Collection.php
@@ -0,0 +1,51 @@
+
+ */
+
+class Mage_Strikeiron_Model_Mysql4_Taxrate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('strikeiron/taxrate');
+ }
+
+ public function addRateFilter($rateId)
+ {
+ if (is_int($rateId) && $rateId > 0) {
+ return $this->_select->where('main_table.tax_rate_id=?', $rateId);
+ }
+ else {
+ return $this;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Service/AddressVerification.php b/app/code/core/Mage/Strikeiron/Model/Service/AddressVerification.php
new file mode 100644
index 0000000000..03bd3485e3
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Service/AddressVerification.php
@@ -0,0 +1,49 @@
+
+ */
+class Mage_Strikeiron_Model_Service_AddressVerification extends Mage_Strikeiron_Model_Service_Base
+{
+ const ADDRESS_ERROR_ACCEPT = 'Accept';
+ const ADDRESS_ERROR_REJECT = 'Reject';
+ const ADDRESS_ERROR_CONFIRM = 'Confirm';
+
+ /**
+ * Configuration options
+ * @param array
+ */
+ protected $_options = array('username' => null,
+ 'password' => null,
+ 'client' => null,
+ 'options' => null,
+ 'headers' => null,
+ 'wsdl' => 'aHR0cDovL3dzLnN0cmlrZWlyb24uY29tL3Zhcmllbi5TdHJpa2VJcm9uL1VTQWRkcmVzc1ZlcmlmaWNhdGlvbjRfMD9XU0RM');
+}
diff --git a/app/code/core/Mage/Strikeiron/Model/Service/Base.php b/app/code/core/Mage/Strikeiron/Model/Service/Base.php
new file mode 100644
index 0000000000..e300892a19
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Service/Base.php
@@ -0,0 +1,61 @@
+
+ */
+require_once 'Zend/Service/StrikeIron/Base.php';
+
+class Mage_Strikeiron_Model_Service_Base extends Zend_Service_StrikeIron_Base
+{
+ public function __construct($options = array())
+ {
+ $this->_options['wsdl'] = $this->_wsdlDecode();
+ parent::__construct($options);
+ }
+
+ public function _wsdlDecode()
+ {
+ return base64_decode($this->_options['wsdl']);
+ }
+
+ public function getOptionData($key)
+ {
+ if( isset($this->_options[$key]) ){
+ return $this->_options[$key];
+ } else {
+ return null;
+ }
+ }
+
+ public function getOptions()
+ {
+ return $this->_options;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Service/EmailVerification.php b/app/code/core/Mage/Strikeiron/Model/Service/EmailVerification.php
new file mode 100644
index 0000000000..f11766465a
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Service/EmailVerification.php
@@ -0,0 +1,48 @@
+
+ */
+class Mage_Strikeiron_Model_Service_EmailVerification extends Mage_Strikeiron_Model_Service_Base
+{
+ const EMAIL_UNDETERMINED_ACCEPT = 'Accept';
+ const EMAIL_UNDETERMINED_REJECT = 'Reject';
+ const EMAIL_UNDETERMINED_CONFIRM = 'Confirm';
+ /**
+ * Configuration options
+ * @param array
+ */
+ protected $_options = array('username' => null,
+ 'password' => null,
+ 'client' => null,
+ 'options' => null,
+ 'headers' => null,
+ 'wsdl' => 'aHR0cDovL3dzLnN0cmlrZWlyb24uY29tL3Zhcmllbi5TdHJpa2VJcm9uL2VtYWlsdmVyaWZ5XzNfMD9XU0RM');
+}
diff --git a/app/code/core/Mage/Strikeiron/Model/Service/ForeignExchangeRates.php b/app/code/core/Mage/Strikeiron/Model/Service/ForeignExchangeRates.php
new file mode 100644
index 0000000000..c74293676a
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Service/ForeignExchangeRates.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Strikeiron_Model_Service_ForeignExchangeRates extends Mage_Strikeiron_Model_Service_Base
+{
+ /**
+ * Configuration options
+ * @param array
+ */
+ protected $_options = array('username' => null,
+ 'password' => null,
+ 'client' => null,
+ 'options' => null,
+ 'headers' => null,
+ 'wsdl' => 'aHR0cDovL3dzLnN0cmlrZWlyb24uY29tL3Zhcmllbi5TdHJpa2VJcm9uL0ZvcmVpZ25FeGNoYW5nZVJhdGU/V1NETA==');
+}
diff --git a/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTax.php b/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTax.php
new file mode 100644
index 0000000000..b258cf0e31
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTax.php
@@ -0,0 +1,40 @@
+
+ */
+class Mage_Strikeiron_Model_Service_SalesUseTax extends Mage_Strikeiron_Model_Service_Base
+{
+ const SALETAX_TYPE_BASIC = 'B';
+ const SALETAX_TYPE_COMPLETE = 'C';
+
+ const SALETAX_COMPLETE_MIN = 'MIN';
+ const SALETAX_COMPLETE_MAX = 'MAX';
+}
diff --git a/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTaxBasic.php b/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTaxBasic.php
new file mode 100644
index 0000000000..710be1503b
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTaxBasic.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Strikeiron_Model_Service_SalesUseTaxBasic extends Mage_Strikeiron_Model_Service_SalesUseTax
+{
+ /**
+ * Configuration options
+ * @param array
+ */
+ protected $_options = array('username' => null,
+ 'password' => null,
+ 'client' => null,
+ 'options' => null,
+ 'headers' => null,
+ 'wsdl' => 'aHR0cDovL3dzLnN0cmlrZWlyb24uY29tL3Zhcmllbi5TdHJpa2VJcm9uL1RheERhdGFCYXNpYzQ/V1NETA==');
+}
diff --git a/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTaxComplete.php b/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTaxComplete.php
new file mode 100644
index 0000000000..69fe2dd13a
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Service/SalesUseTaxComplete.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Strikeiron_Model_Service_SalesUseTaxComplete extends Mage_Strikeiron_Model_Service_SalesUseTax
+{
+ /**
+ * Configuration options
+ * @param array
+ */
+ protected $_options = array('username' => null,
+ 'password' => null,
+ 'client' => null,
+ 'options' => null,
+ 'headers' => null,
+ 'wsdl' => 'aHR0cDovL3dzLnN0cmlrZWlyb24uY29tL3Zhcmllbi5TdHJpa2VJcm9uL1RheERhdGFDb21wbGV0ZTQ/V1NETA==');
+}
diff --git a/app/code/core/Mage/Strikeiron/Model/Service/UsAddressVerification.php b/app/code/core/Mage/Strikeiron/Model/Service/UsAddressVerification.php
new file mode 100644
index 0000000000..a7232b6366
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Service/UsAddressVerification.php
@@ -0,0 +1,45 @@
+
+ */
+class Mage_Strikeiron_Model_Service_UsAddressVerification extends Mage_Strikeiron_Model_Service_AddressVerification
+{
+ /**
+ * Configuration options
+ * @param array
+ */
+ protected $_options = array('username' => null,
+ 'password' => null,
+ 'client' => null,
+ 'options' => null,
+ 'headers' => null,
+ 'wsdl' => 'aHR0cDovL3dzLnN0cmlrZWlyb24uY29tL3Zhcmllbi5TdHJpa2VJcm9uL1VTQWRkcmVzc1ZlcmlmaWNhdGlvbjRfMD9XU0RM');
+}
diff --git a/app/code/core/Mage/Strikeiron/Model/Session.php b/app/code/core/Mage/Strikeiron/Model/Session.php
new file mode 100644
index 0000000000..10038e13d1
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Session.php
@@ -0,0 +1,39 @@
+
+ */
+class Mage_Strikeiron_Model_Session extends Mage_Core_Model_Session_Abstract
+{
+ public function __construct()
+ {
+ $this->init('strikeiron');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Source/ErrorAddressAction.php b/app/code/core/Mage/Strikeiron/Model/Source/ErrorAddressAction.php
new file mode 100644
index 0000000000..ab3dd9e4fb
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Source/ErrorAddressAction.php
@@ -0,0 +1,42 @@
+
+ */
+class Mage_Strikeiron_Model_Source_ErrorAddressAction
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => Mage_Strikeiron_Model_Service_AddressVerification::ADDRESS_ERROR_ACCEPT, 'label' => Mage::helper('strikeiron')->__('Accept')),
+ array('value' => Mage_Strikeiron_Model_Service_AddressVerification::ADDRESS_ERROR_REJECT, 'label' => Mage::helper('strikeiron')->__('Reject')),
+ array('value' => Mage_Strikeiron_Model_Service_AddressVerification::ADDRESS_ERROR_CONFIRM, 'label' => Mage::helper('strikeiron')->__('Pop up warning and accept')),
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Source/SalesTaxType.php b/app/code/core/Mage/Strikeiron/Model/Source/SalesTaxType.php
new file mode 100644
index 0000000000..2313ab3f79
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Source/SalesTaxType.php
@@ -0,0 +1,42 @@
+
+ */
+class Mage_Strikeiron_Model_Source_SalesTaxType
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => Mage_Strikeiron_Model_Service_SalesUseTax::SALETAX_TYPE_BASIC, 'label' => Mage::helper('strikeiron')->__('Basic')),
+ array('value' => Mage_Strikeiron_Model_Service_SalesUseTax::SALETAX_TYPE_COMPLETE, 'label' => Mage::helper('strikeiron')->__('Complete')),
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Source/Salestaxminmax.php b/app/code/core/Mage/Strikeiron/Model/Source/Salestaxminmax.php
new file mode 100644
index 0000000000..c422c24f4c
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Source/Salestaxminmax.php
@@ -0,0 +1,42 @@
+
+ */
+class Mage_Strikeiron_Model_Source_Salestaxminmax
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => Mage_Strikeiron_Model_Service_SalesUseTax::SALETAX_COMPLETE_MIN, 'label' => Mage::helper('strikeiron')->__('Minimum tax rate')),
+ array('value' => Mage_Strikeiron_Model_Service_SalesUseTax::SALETAX_COMPLETE_MAX , 'label' => Mage::helper('strikeiron')->__('Maximum tax rate')),
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Source/UndeterminedEmailAction.php b/app/code/core/Mage/Strikeiron/Model/Source/UndeterminedEmailAction.php
new file mode 100644
index 0000000000..73d94bbd37
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Source/UndeterminedEmailAction.php
@@ -0,0 +1,42 @@
+
+ */
+class Mage_Strikeiron_Model_Source_UndeterminedEmailAction
+{
+ public function toOptionArray()
+ {
+ return array(
+ array('value' => Mage_Strikeiron_Model_Service_EmailVerification::EMAIL_UNDETERMINED_ACCEPT, 'label' => Mage::helper('strikeiron')->__('Accept')),
+ array('value' => Mage_Strikeiron_Model_Service_EmailVerification::EMAIL_UNDETERMINED_REJECT, 'label' => Mage::helper('strikeiron')->__('Reject')),
+ array('value' => Mage_Strikeiron_Model_Service_EmailVerification::EMAIL_UNDETERMINED_CONFIRM, 'label' => Mage::helper('strikeiron')->__('Pop up warning and accept')),
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Strikeiron.php b/app/code/core/Mage/Strikeiron/Model/Strikeiron.php
new file mode 100644
index 0000000000..bcee12fed7
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Strikeiron.php
@@ -0,0 +1,391 @@
+
+ */
+class Mage_Strikeiron_Model_Strikeiron extends Mage_Core_Model_Abstract
+{
+ public function getApi($service, $options = array())
+ {
+ return Mage::getSingleton('strikeiron/service_'.$service, array_merge($this->getConfiguration(),$options));
+ }
+
+ protected function getConfiguration()
+ {
+ return array('username'=> $this->getConfigData('config', 'user') , 'password'=> $this->getConfigData('config', 'password'));
+ }
+
+ public function getConfigData($code, $field)
+ {
+ $path = 'strikeiron/'.$code.'/'.$field;
+ return Mage::getStoreConfig($path);
+ }
+
+/*********************** EMAIL VERIFICATION***************************/
+ /*
+ verify email address is valid or not
+ wsdl = http://ws.strikeiron.com/varien.StrikeIron/emailverify_3_0?WSDL
+ */
+ public function emailVerify($email)
+ {
+ if ($email && $this->getConfigData('email_verification', 'active')) {
+ $_session = Mage::getSingleton('strikeiron/session');
+ /*
+ * following flag will set if the email is undetermined for the first time
+ * for second time, we just need to return true
+ */
+ if ($_session->getStrikeironUndertermined()==$email) {
+ $_session->unsStrikeironUndertermined();
+ return true;
+ }
+
+ $emailApi = $this->getApi('emailVerification');
+
+ $checkAllServer = $this->getConfigData('email_verification', 'check_allservers');
+ $emailArr = array(
+ 'email' => $email,
+ 'checkAllServers' => ($checkAllServer ? 'True' : 'False')
+ );
+ $result = '';
+
+ try {
+ $subscriptionInfo = $emailApi->getSubscriptionInfo();
+ if ($subscriptionInfo && $subscriptionInfo->remainingHits>0) {
+ $result = $emailApi->validateEmail($emailArr);
+ if ($result) {
+ switch ($result->IsValid) {
+ case 'INVALID':
+ Mage::throwException(Mage::helper('strikeiron')->__('Invalid email address'));
+ break;
+ case 'UNDETERMINED':
+ switch($this->getConfigData('email_verification', 'undetermined_action')) {
+ case Mage_Strikeiron_Model_Service_EmailVerification::EMAIL_UNDETERMINED_REJECT:
+ Mage::throwException(Mage::helper('strikeiron')->__('Invalid email address'));
+ break;
+ case Mage_Strikeiron_Model_Service_EmailVerification::EMAIL_UNDETERMINED_CONFIRM:
+ $_session->setStrikeironUndertermined($email);
+ Mage::throwException(Mage::helper('strikeiron')->__('Email address cannot be verified. Please check again and make sure your email address entered correctly.'));
+ break;
+ }
+ break;
+ }
+ } else {
+ Mage::throwException(Mage::helper('strikeiron')->__('There is an error in verifying an email. Please contact us.'));
+ }
+
+ } else {
+ /*
+ * when there is no more remaining hits for service
+ * we will send email to email recipient for exception
+ */
+ /* @var $mailTemplate Mage_Core_Model_Email_Template */
+ $receipient = $this->getConfigData('email_verification', 'error_email');
+ if ($receipient) {
+ $translate = Mage::getSingleton('core/translate');
+ /* @var $translate Mage_Core_Model_Translate */
+ $translate->setTranslateInline(false);
+
+ $mailTemplate = Mage::getModel('core/email_template');
+ $mailTemplate->setDesignConfig(
+ array(
+ 'area' => 'frontend',
+ )
+ )
+ ->sendTransactional(
+ $this->getConfigData('email_verification', 'error_email_template'),
+ $this->getConfigData('email_verification', 'error_email_identity'),
+ $receipient,
+ null,
+ array(
+ 'email' => $email,
+ 'warnings' => $e->getMessage(),
+ )
+ );
+
+ $translate->setTranslateInline(true);
+ }
+
+ }
+ } catch (Zend_Service_StrikeIron_Exception $e) {
+ Mage::throwException(Mage::helper('strikeiron')->__('There is an error in verifying an email. Please contact us.'));
+ }
+ }
+ return true;
+ }
+
+/*********************** FOREIGN CURRENCY EXCHANGE***************************/
+
+ public function _getAllSupportedCurrencies($exchangeApi)
+ {
+ $result = $exchangeApi->GetSupportedCurrencies();
+ $data = array();
+ if ($result && $result->ServiceStatus && $result->ServiceStatus->StatusNbr == 210) {
+ $listings = $result->ServiceResult->Listings;
+ if ($listings && $listings->CurrencyListing) {
+ foreach($listings->CurrencyListing as $listing){
+ $data[] = $listing->Symbol;
+ }
+ }
+ }
+ return $data;
+ }
+
+ /*
+ retrieving foreign exchange rate for the currency
+ wsdl = http://ws.strikeiron.com/varien.StrikeIron/ForeignExchangeRate?WSDL
+ */
+ public function fetchExchangeRate ($defaultCurrency, $currencies=array())
+ {
+ if(!$this->getConfigData('currency', 'foreigh_xrate')){
+ Mage::throwException(Mage::helper('strikeiron')->__('Strikeiron foreign exchange rate is disabled'));
+ }
+
+ $data = array();
+ $exchangeApi = $this->getApi('foreignExchangeRates');
+ $result = '';
+ try {
+ $subscriptionInfo = $exchangeApi->getSubscriptionInfo();
+ if ($subscriptionInfo && $subscriptionInfo->remainingHits>0) {
+ $supportedCurrencies = $this->_getAllSupportedCurrencies($exchangeApi);
+ if($supportedCurrencies) {
+ $availableCurrencies = array_intersect($currencies, $supportedCurrencies);
+ if($availableCurrencies && in_array($defaultCurrency,$supportedCurrencies)){
+ $currenciesStr = implode(', ' , $availableCurrencies);
+ $reqArr = array(
+ 'CommaSeparatedListOfCurrenciesFrom' => $currenciesStr,
+ 'SingleCurrencyTo' => $defaultCurrency
+ );
+ $result = $exchangeApi->GetLatestRates($reqArr);
+ if ($result) {
+ /*
+ 212 = Currency rate data Found
+ */
+ if ($result->ServiceStatus && $result->ServiceStatus->StatusNbr == 212) {
+ $listings = $result->ServiceResult->Listings;
+ if($listings && $listings->ExchangeRateListing) {
+ foreach ($listings->ExchangeRateListing as $listing) {
+ $data[$listing->PerCurrency][$listing->Currency] = $listing->Value;
+ }
+ }
+ } else {
+ Mage::throwException($result->ServiceStatus->StatusDescription);
+ }
+ } else {
+ Mage::throwException(Mage::helper('strikeiron')->__('There is no response back from Strikeiron server'));
+ }
+ }
+ }
+ } else {
+ Mage::throwException(Mage::helper('strikeiron')->__('There is no more hits remaining for the foreign Exchange Rate Service.'));
+ }
+ } catch (Zend_Service_StrikeIron_Exception $e) {
+ Mage::throwException(Mage::helper('strikeiron')->__('There is no response back from Strikeiron server'));
+ }
+ return $data;
+ }
+
+ public function customerSaveBeforeObserver($observer)
+ {
+ $customer = $observer->getEvent()->getCustomer();
+ $isAdmin = Mage::getDesign()->getArea()==='adminhtml';
+ $email = $customer->getEmail();
+ $host = Mage::app()->getStore()->getConfig(Mage_Customer_Model_Customer::XML_PATH_DEFAULT_EMAIL_DOMAIN);
+ $fakeEmail = $customer->getIncrementId().'@'. $host;
+ if ($email && $email != $fakeEmail && $customer->dataHasChangedFor('email') &&
+ (!$isAdmin || ($isAdmin && $this->getConfigData('email_verification', 'check_admin')))
+ ) {
+ $this->emailVerify($email);
+ }
+ }
+
+/*********************** ADDRESS VERIFICATION***************************/
+
+ public function addressSaveBeforeObserver($observer)
+ {
+ $address = $observer->getEvent()->getCustomerAddress();
+ $us = $address->getCountryId() == 'US';
+ $addressDataChange = sizeof($address) == 1 && ( $address->dataHasChangedFor('street') || $address->dataHasChangedFor('city') ||
+ $address->dataHasChangedFor('postcode') || $address->dataHasChangedFor('country_id') || $address->dataHasChangedFor('region_id') ||
+ $address->dataHasChangedFor('region'))
+ ;
+ if ($addressDataChange) {
+ if ($us) {
+ $this->UsAddressVerify($address);
+ }
+ }
+
+ }
+
+ /*
+ verify US address is valid or not
+ wsdl = http://ws.strikeiron.com/varien.StrikeIron/USAddressVerification4_0?WSDL
+ $subscription = $taxBasic->getSubscriptionInfo();
+ echo $subscription->remainingHits;
+
+ */
+ public function UsAddressVerify($address)
+ {
+//echo "";
+//print_r($address);
+return;
+$_session = Mage::getSingleton('strikeiron/session');
+ $usAddressApi = $this->getApi('usAddressVerification');
+ $cityStateZip = $address->getCity()." ".$address->getRegionCode()." ".$address->getPostcode();
+ $reqArr = array(
+ 'firm' => $address->getCompany(),
+ 'addressLine1' => $address->getStreet(1),
+ 'addressLine2' => $address->getStreet(2),
+ 'city_state_zip' => $cityStateZip )
+ ;
+ $result = '';
+ try {
+ $subscriptionInfo = $usAddressApi->getSubscriptionInfo();
+ if ($subscriptionInfo && $subscriptionInfo->remainingHits>0) {
+ $result = $usAddressApi->verifyAddressUSA($reqArr);
+//$result = $_session->getUsAddressVerify();
+//$_session->setUsAddressVerify($result);
+//print_r($reqArr);
+//print_r($result);
+ } else {
+
+ }
+
+ } catch (Zend_Service_StrikeIron_Exception $e) {
+ Mage::throwException(Mage::helper('strikeiron')->__('There is no response back from Strikeiron server'));
+ }
+ return true;
+ }
+
+/*********************** SALES AND TAX RATE***************************/
+ /*
+ retrieveing the sale tax rate by zip code for US and by province by canada
+ wsdl = http://ws.strikeiron.com/varien.StrikeIron/TaxDataBasic4?WSDL
+ wsdl = http://ws.strikeiron.com/varien.StrikeIron/TaxDataComplete4?WSDL
+ this method is called by event handler
+ event is added in Mage_Tax_Model_Rate_Data
+ */
+ public function getTaxRate($observer)
+ {
+ $data = $observer->getEvent()->getRequest();
+// $data = new Varien_Object();
+// $data->setProductClassId(2)
+// ->setCustomerClassId(3)
+// ->setCountryId('CN')
+// ->setRegionId('74')
+// ->setPostcode('95618');
+
+ $tax_rate = 0;
+ $customerTaxClass = array();
+ $customerTaxClass = explode(',' ,$this->getConfigData('sales_tax', 'customer_tax_class'));
+ $productTaxClass = array();
+ $productTaxClass = explode(',' , $this->getConfigData('sales_tax', 'product_tax_class'));
+ if ($this->getConfigData('sales_tax', 'active')
+ && in_array($data->getCustomerClassId(), $customerTaxClass)
+ && in_array($data->getProductClassId(), $productTaxClass)
+ && ($data->getCountryId()=='US' || $data->getCountryId()=='CN')
+ ) {
+ $type = $this->getConfigData('sales_tax', 'type');
+ $isBasic = false;
+ if($type == 'B') {
+ $isBasic = true;
+ }
+
+ $saleTaxApi = $this->getApi('salesUseTax'.($isBasic ? 'Basic' : 'Complete'));
+ try {
+ $subscriptionInfo = $saleTaxApi->getSubscriptionInfo();
+ if ($subscriptionInfo && $subscriptionInfo->remainingHits>0) {
+ if ($data->getCountryId()=='US') {
+ if ($isBasic) {
+ $requestArr = array('zip_code' => $data->getPostcode());
+ $result = $saleTaxApi->GetTaxRateUS($requestArr);
+ if ($result) {
+ $tax_rate = $result->total_sales_tax;
+ }
+ } else {
+ $requestArr = array('zipCode' => $data->getPostcode());
+
+ $result = $saleTaxApi->GetUSATaxRatesByZipCode($requestArr);
+ if ($result && $result->USATaxRate) {
+ $tax_rate = $this->parseTaxRateComplete($result);
+ }
+ }
+ } else {
+ $region_code = Mage::getSingleton('directory/region')->load($data->getRegionId())->getCode();
+ $requestArr = array('province' => $region_code);
+ if ($isBasic) {
+ $result = $saleTaxApi->GetTaxRateCanada($requestArr);
+ if ($result) {
+ $tax_rate = $result->total;
+ }
+ } else {
+ $result = $saleTaxApi->GetCanadaTaxRatesByProvince($requestArr);
+ if ($result && $result->CanadaTaxRate) {
+ $tax_rate = $result->CanadaTaxRate->Total;
+ }
+ }
+ }
+ }
+ } catch (Zend_Service_StrikeIron_Exception $e) {
+ //we won't throw exception
+ //since the method is calling via event handler
+ //Mage::throwException(Mage::helper('strikeiron')->__('There is an error in retrieving tax rate. Please contact us'));
+ }
+ }
+
+ if ($tax_rate>0) {
+ $tax_rate = $tax_rate * 100;
+ $dbObj = Mage::getSingleton('strikeiron/taxrate')
+ ->setTaxCountryId($data->getCountryId())
+ ->setTaxRegionId($data->getRegionId())
+ ->setTaxPostcode($data->getPostcode())
+ ->setRateValue($tax_rate)
+ ->save();
+ $data->setRateValue($tax_rate);
+ $data->setRateTitle(Mage::helper('strikeiron')->__('Tax'));
+ $data->setRateId('strikeiron_tax');
+ }
+ return $this;
+
+ }
+
+ protected function parseTaxRateComplete($result)
+ {
+ $tax_array = array();
+ foreach ($result->USATaxRate as $rate) {
+ if($rate->TotalSalesTax>0) {
+ $tax_array[] = $rate->TotalSalesTax;
+ }
+ }
+ $minMax = strtolower($this->getConfigData('sales_tax', 'min_max'));
+ return $minMax($tax_array);
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/Model/Taxrate.php b/app/code/core/Mage/Strikeiron/Model/Taxrate.php
new file mode 100644
index 0000000000..138517b5d6
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/Model/Taxrate.php
@@ -0,0 +1,37 @@
+
+ */
+class Mage_Strikeiron_Model_Taxrate extends Mage_Core_Model_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('strikeiron/taxrate');
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/controllers/TestController.php b/app/code/core/Mage/Strikeiron/controllers/TestController.php
new file mode 100644
index 0000000000..78f6817107
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/controllers/TestController.php
@@ -0,0 +1,42 @@
+
+ */
+
+class Mage_Strikeiron_TestController extends Mage_Core_Controller_Front_Action
+{
+ public function indexAction()
+ {
+ $model = Mage::getModel('strikeiron/strikeiron');
+ $model->getTaxRate();
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/etc/config.xml b/app/code/core/Mage/Strikeiron/etc/config.xml
new file mode 100644
index 0000000000..efab187f34
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/etc/config.xml
@@ -0,0 +1,176 @@
+
+
+
+
+
+ 0.9.1
+
+
+
+
+
+
+
+ StrikeIron
+ strikeiron/currency_import_strikeiron
+
+
+
+
+
+
+ Mage_Strikeiron_Model
+ strikeiron_mysql4
+
+
+ Mage_Strikeiron_Model_Mysql4
+
+
+
+
+
+
+
+
+
+
+ Mage_Strikeiron
+
+
+ core_setup
+
+
+
+
+ core_write
+
+
+
+
+ core_read
+
+
+
+
+
+
+
+ singleton
+ strikeiron/strikeiron
+ customerSaveBeforeObserver
+
+
+
+
+
+
+ singleton
+ strikeiron/strikeiron
+ addressSaveBeforeObserver
+
+
+
+
+
+
+ singleton
+ strikeiron/strikeiron
+ getTaxRate
+
+
+
+
+
+
+
+ Strikeiron Email Update Warnings
+ strikeiron_email_warning.html
+ text
+
+
+
+
+
+
+
+
+
+
+
+ accept
+ strikeiron_customer_error_email_template
+
+
+ B
+ MAX
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Strikeiron Section
+ 75
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mage_Strikeiron.csv
+
+
+
+
+
+
+
+
+ standard
+
+ Mage_Strikeiron
+ strikeiron
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/etc/system.xml b/app/code/core/Mage/Strikeiron/etc/system.xml
new file mode 100644
index 0000000000..cb0d19d7c6
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/etc/system.xml
@@ -0,0 +1,291 @@
+
+
+
+
+
+ Strikeiron
+ service
+ text
+ 100
+ 1
+ 1
+ 1
+
+
+ Strikeiron Config
+ text
+ 1
+ 1
+ 1
+ 1
+
+
+ User ID
+ obscure
+ adminhtml/system_config_backend_encrypted
+ 1
+ 1
+ 1
+ 1
+
+
+ Password
+ obscure
+ adminhtml/system_config_backend_encrypted
+ 2
+ 1
+ 1
+ 0
+
+
+
+
+ Email Verification
+ text
+ 2
+ 1
+ 1
+ 1
+
+
+ Enable email verification
+ select
+ adminhtml/system_config_source_enabledisable
+ 1
+ 1
+ 1
+ 1
+
+
+ Verify email in admin
+ select
+ adminhtml/system_config_source_yesno
+ 2
+ 1
+ 1
+ 1
+
+
+ Check all email servers
+ select
+ adminhtml/system_config_source_yesno
+ 3
+ 1
+ 1
+ 1
+
+
+ Undetermined email action
+ select
+ strikeiron/source_undeterminedEmailAction
+ 4
+ 1
+ 1
+ 1
+
+
+ Error Email Recipient
+ text
+ 5
+ 1
+ 1
+ 1
+
+
+ Error Email Sender
+ select
+ adminhtml/system_config_source_email_identity
+ 6
+ 1
+ 1
+ 0
+
+
+ Error Email Template
+ select
+ adminhtml/system_config_source_email_template
+ 7
+ 1
+ 1
+ 0
+
+
+
+
+ Foreign Exchange Rates
+ text
+ 3
+ 1
+ 1
+ 1
+
+
+ Enable foreign exchange rate
+ select
+ adminhtml/system_config_source_enabledisable
+ 10
+ 1
+ 1
+ 1
+
+
+
+
+ US Address Verification
+ text
+ 4
+ 1
+ 1
+ 1
+
+
+ Enable US address verification
+ select
+ adminhtml/system_config_source_enabledisable
+ 1
+ 1
+ 1
+ 1
+
+
+ Verify address in admin
+ select
+ adminhtml/system_config_source_yesno
+ 2
+ 1
+ 1
+ 1
+
+
+ Error address action
+ select
+ strikeiron/source_errorAddressAction
+ 4
+ 1
+ 1
+ 1
+
+
+
+
+ Global Address Verification
+ text
+ 5
+ 1
+ 1
+ 1
+
+
+ Enable global address verification
+ select
+ adminhtml/system_config_source_enabledisable
+ 1
+ 1
+ 1
+ 1
+
+
+ Verify address in admin
+ select
+ adminhtml/system_config_source_yesno
+ 2
+ 1
+ 1
+ 1
+
+
+ Error address action
+ select
+ strikeiron/source_errorAddressAction
+ 4
+ 1
+ 1
+ 1
+
+
+
+
+ Sales and Use Tax
+ text
+ 6
+ 1
+ 1
+ 1
+
+
+ Enable sales and use tax
+ select
+ adminhtml/system_config_source_enabledisable
+ 1
+ 1
+ 1
+ 1
+
+
+ Sales and Use Tax Type
+ select
+ strikeiron/source_salesTaxType
+ 3
+ 1
+ 1
+ 1
+
+
+ Use
+ If type is complete and zip code belongs to multiple tax rates, choose to charge minimum tax rate or maximum tax rate.
+ select
+ strikeiron/source_salestaxminmax
+ 4
+ 1
+ 1
+ 1
+
+
+ Customer Tax Class
+ multiselect
+ tax/class_source_customer
+ 5
+ 1
+ 1
+ 1
+
+
+ Product Tax Class
+ multiselect
+ tax/class_source_product
+ 6
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/code/core/Mage/Strikeiron/sql/strikeiron_setup/mysql4-install-0.9.1.php b/app/code/core/Mage/Strikeiron/sql/strikeiron_setup/mysql4-install-0.9.1.php
new file mode 100644
index 0000000000..446c02c458
--- /dev/null
+++ b/app/code/core/Mage/Strikeiron/sql/strikeiron_setup/mysql4-install-0.9.1.php
@@ -0,0 +1,48 @@
+startSetup();
+
+$installer->run("
+/*Table structure for table `strikeiron_tax_rate` */
+
+DROP TABLE IF EXISTS {$this->getTable('strikeiron_tax_rate')};
+
+CREATE TABLE {$this->getTable('strikeiron_tax_rate')} (
+ `tax_rate_id` tinyint(4) NOT NULL auto_increment,
+ `tax_country_id` varchar(6) default NULL,
+ `tax_region_id` mediumint(9) unsigned default NULL,
+ `tax_postcode` varchar(12) default NULL,
+ `rate_value` decimal(12,4) NOT NULL default '0.0000',
+ PRIMARY KEY (`tax_rate_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Strikeiron tax rates';
+
+ ");
+
+$installer->endSetup();
diff --git a/app/code/core/Mage/Tag/Block/Customer/Recent.php b/app/code/core/Mage/Tag/Block/Customer/Recent.php
index 9a4527288f..5b417cc8e2 100644
--- a/app/code/core/Mage/Tag/Block/Customer/Recent.php
+++ b/app/code/core/Mage/Tag/Block/Customer/Recent.php
@@ -43,11 +43,15 @@ protected function _construct()
$this->_collection = Mage::getModel('tag/tag')->getEntityCollection()
->addStoreFilter(Mage::app()->getStore()->getId())
->addCustomerFilter(Mage::getSingleton('customer/session')->getCustomerId())
+ ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->setDescOrder()
->setPageSize(5)
->setActiveFilter()
->load()
->addProductTags();
+
+ Mage::getSingleton('catalog/product_visibility')
+ ->addVisibleInSiteFilterToCollection($this->_collection);
}
public function count()
diff --git a/app/code/core/Mage/Tag/Model/Mysql4/Tag/Relation.php b/app/code/core/Mage/Tag/Model/Mysql4/Tag/Relation.php
index 91d5d674c1..bda66117b5 100644
--- a/app/code/core/Mage/Tag/Model/Mysql4/Tag/Relation.php
+++ b/app/code/core/Mage/Tag/Model/Mysql4/Tag/Relation.php
@@ -85,8 +85,7 @@ public function getProductIds($model)
$select = $this->_getReadAdapter()->select()
->from($this->getMainTable(), 'product_id')
->where("tag_id=?", $model->getTagId())
- ->where('customer_id=?', $model->getCustomerId())
- ->where('active=1');
+ ->where('customer_id=?', $model->getCustomerId());
if ($model->hasStoreId()) {
$select->where('store_id = ?', $model->getStoreId());
}
diff --git a/app/code/core/Mage/Tag/controllers/CustomerController.php b/app/code/core/Mage/Tag/controllers/CustomerController.php
index be66d6017c..5bbd01d3e9 100644
--- a/app/code/core/Mage/Tag/controllers/CustomerController.php
+++ b/app/code/core/Mage/Tag/controllers/CustomerController.php
@@ -176,14 +176,14 @@ public function saveAction()
$tagRelationModel->loadByTagCustomer(null, $tagModel->getId(), $customerId, $storeId)
->deactivate();
- $tagModel->loadByName($tagName);
+ $existingTagModel = Mage::getModel('tag/tag')->loadByName($tagName);
- if($tagModel->getId()) {
- $status = $tagModel->getStatus();
+ if($existingTagModel->getId()) {
+ $status = $existingTagModel->getStatus();
}
else {
$message= Mage::helper('tag')->__('Thank you. Your tag has been accepted for moderation.');
- $status = $tagModel->getPendingStatus();
+ $status = $existingTagModel->getPendingStatus();
}
$tagModel->setName($tagName)
@@ -209,6 +209,7 @@ public function saveAction()
->setStoreId($storeId)
->setActive(true)
->setProductId($productId)
+ ->setCreatedAt( $tagRelationModel->getResource()->formatDate(time()) )
->save();
}
}
diff --git a/app/code/core/Mage/Tag/controllers/IndexController.php b/app/code/core/Mage/Tag/controllers/IndexController.php
index d9eb3f48d4..37f19d209d 100644
--- a/app/code/core/Mage/Tag/controllers/IndexController.php
+++ b/app/code/core/Mage/Tag/controllers/IndexController.php
@@ -94,7 +94,7 @@ public function saveAction()
->setCustomerId($customerId)
->setProductId($productId)
->setStoreId(Mage::app()->getStore()->getId())
- ->setCreatedAt( now() )
+ ->setCreatedAt( $tagRelationModel->getResource()->formatDate(time()) )
->setActive(1)
->save();
$tagModel->aggregate();
diff --git a/app/code/core/Mage/Tax/Block/Checkout/Discount.php b/app/code/core/Mage/Tax/Block/Checkout/Discount.php
new file mode 100644
index 0000000000..0f377a9607
--- /dev/null
+++ b/app/code/core/Mage/Tax/Block/Checkout/Discount.php
@@ -0,0 +1,41 @@
+
+ */
+
+class Mage_Tax_Block_Checkout_Discount extends Mage_Checkout_Block_Total_Default
+{
+ //protected $_template = 'tax/checkout/subtotal.phtml';
+
+ public function displayBoth()
+ {
+ return Mage::getSingleton('tax/config')->displayCartSubtotalBoth();
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Block/Checkout/Grandtotal.php b/app/code/core/Mage/Tax/Block/Checkout/Grandtotal.php
new file mode 100644
index 0000000000..4238423fe7
--- /dev/null
+++ b/app/code/core/Mage/Tax/Block/Checkout/Grandtotal.php
@@ -0,0 +1,61 @@
+
+ */
+
+class Mage_Tax_Block_Checkout_Grandtotal extends Mage_Checkout_Block_Total_Default
+{
+ protected $_template = 'tax/checkout/grandtotal.phtml';
+
+ /**
+ * Check if we have include tax amount between grandtotal incl/excl tax
+ *
+ * @return bool
+ */
+ public function includeTax()
+ {
+ if ($this->getTotal()->getAddress()->getGrandTotal()) {
+ return Mage::getSingleton('tax/config')->displayCartTaxWithGrandTotal($this->getStore());
+ }
+ return false;
+ }
+
+ /**
+ * Get grandtotal exclude tax
+ *
+ * @return float
+ */
+ public function getTotalExclTax()
+ {
+ $excl = $this->getTotal()->getAddress()->getGrandTotal()-$this->getTotal()->getAddress()->getTaxAmount();
+ $excl = max($excl, 0);
+ return $excl;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Block/Checkout/Shipping.php b/app/code/core/Mage/Tax/Block/Checkout/Shipping.php
new file mode 100644
index 0000000000..c5676fbb36
--- /dev/null
+++ b/app/code/core/Mage/Tax/Block/Checkout/Shipping.php
@@ -0,0 +1,97 @@
+
+ */
+
+class Mage_Tax_Block_Checkout_Shipping extends Mage_Checkout_Block_Total_Default
+{
+ protected $_template = 'tax/checkout/shipping.phtml';
+
+ /**
+ * Check if we need display shipping include and exlude tax
+ *
+ * @return bool
+ */
+ public function displayBoth()
+ {
+ return Mage::getSingleton('tax/config')->displayCartShippingBoth($this->getStore());
+ }
+
+ /**
+ * Check if we need display shipping include tax
+ *
+ * @return bool
+ */
+ public function displayIncludeTax()
+ {
+ return Mage::getSingleton('tax/config')->displayCartShippingInclTax($this->getStore());
+ }
+
+ /**
+ * Get shipping amount include tax
+ *
+ * @return float
+ */
+ public function getShippingIncludeTax()
+ {
+ return $this->getTotal()->getAddress()->getShippingAmount() +
+ $this->getTotal()->getAddress()->getShippingTaxAmount();
+ }
+
+ /**
+ * Get shipping amount exclude tax
+ *
+ * @return float
+ */
+ public function getShippingExcludeTax()
+ {
+ return $this->getTotal()->getAddress()->getShippingAmount();
+ }
+
+ /**
+ * Get label for shipping include tax
+ *
+ * @return float
+ */
+ public function getIncludeTaxLabel()
+ {
+ return $this->helper('tax')->__('Shipping Incl. Tax (%s)', $this->getTotal()->getAddress()->getShippingDescription());
+ }
+
+ /**
+ * Get label for shipping exclude tax
+ *
+ * @return float
+ */
+ public function getExcludeTaxLabel()
+ {
+ return $this->helper('tax')->__('Shipping Excl. Tax (%s)', $this->getTotal()->getAddress()->getShippingDescription());
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Block/Checkout/Subtotal.php b/app/code/core/Mage/Tax/Block/Checkout/Subtotal.php
new file mode 100644
index 0000000000..b702fcb8c2
--- /dev/null
+++ b/app/code/core/Mage/Tax/Block/Checkout/Subtotal.php
@@ -0,0 +1,41 @@
+
+ */
+
+class Mage_Tax_Block_Checkout_Subtotal extends Mage_Checkout_Block_Total_Default
+{
+ protected $_template = 'tax/checkout/subtotal.phtml';
+
+ public function displayBoth()
+ {
+ return Mage::getSingleton('tax/config')->displayCartSubtotalBoth($this->getStore());
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Block/Checkout/Tax.php b/app/code/core/Mage/Tax/Block/Checkout/Tax.php
new file mode 100644
index 0000000000..1f8f913469
--- /dev/null
+++ b/app/code/core/Mage/Tax/Block/Checkout/Tax.php
@@ -0,0 +1,36 @@
+
+ */
+class Mage_Tax_Block_Checkout_Tax extends Mage_Checkout_Block_Total_Default
+{
+ protected $_template = 'tax/checkout/tax.phtml';
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Block/Sales/Order/Tax.php b/app/code/core/Mage/Tax/Block/Sales/Order/Tax.php
new file mode 100644
index 0000000000..d7cd0de132
--- /dev/null
+++ b/app/code/core/Mage/Tax/Block/Sales/Order/Tax.php
@@ -0,0 +1,277 @@
+_config = Mage::getSingleton('tax/config');
+ }
+
+ /**
+ * Check if we nedd display full tax total info
+ *
+ * @return bool
+ */
+ public function displayFullSummary()
+ {
+ return $this->_config->displaySalesFullSummary($this->getOrder()->getStore());
+ }
+
+ /**
+ * Get data (totals) source model
+ *
+ * @return Varien_Object
+ */
+ public function getSource()
+ {
+ return $this->_source;
+ }
+
+ /**
+ * Initialize all order totals relates with tax
+ *
+ * @return Mage_Tax_Block_Sales_Order_Tax
+ */
+ public function initTotals()
+ {
+ $parent = $this->getParentBlock();
+ $this->_order = $parent->getOrder();
+ $this->_source = $parent->getSource();
+
+ $store = $this->getStore();
+ $allowTax = ($this->_source->getTaxAmount() > 0) || ($this->_config->displaySalesZeroTax($store));
+ $grandTotal = (float) $this->_source->getGrandTotal();
+ if (!$grandTotal || ($allowTax && !$this->_config->displaySalesTaxWithGrandTotal($store))) {
+ $this->_addTax();
+ }
+
+ $this->_initSubtotal();
+ $this->_initShipping();
+ $this->_initDiscount();
+ $this->_initGrandTotal();
+ return $this;
+ }
+
+ protected function _addTax($after='discount')
+ {
+ $taxTotal = new Varien_Object(array(
+ 'code' => 'tax',
+ 'block_name'=> $this->getNameInLayout()
+ ));
+ $this->getParentBlock()->addTotal($taxTotal, $after);
+ return $this;
+ }
+
+ public function getStore()
+ {
+ return $this->_order->getStore();
+ }
+
+ protected function _initSubtotal()
+ {
+ $store = $this->getStore();
+ $parent = $this->getParentBlock();
+ $subtotal = $parent->getTotal('subtotal');
+ if (!$subtotal) {
+ return $this;
+ }
+ if ($this->_config->displaySalesSubtotalBoth($store)) {
+ $subtotal = $this->_source->getSubtotal();
+ $baseSubtotal = $this->_source->getBaseSubtotal();
+ $subtotalIncl = $this->_source->getSubtotalInclTax();
+ $baseSubtotalIncl= $this->_source->getBaseSubtotalInclTax();
+
+ if (!$subtotalIncl) {
+ $subtotalIncl = $subtotal+ $this->_source->getTaxAmount()
+ - $this->_source->getShippingTaxAmount();
+ }
+ if (!$baseSubtotalIncl) {
+ $baseSubtotalIncl = $baseSubtotal + $this->_source->getBaseTaxAmount()
+ - $this->_source->getBaseShippingTaxAmount();
+ }
+
+ $totalExcl = new Varien_Object(array(
+ 'code' => 'subtotal_excl',
+ 'value' => $subtotal,
+ 'base_value'=> $baseSubtotal,
+ 'label' => $this->__('Subtotal (Excl.Tax)')
+ ));
+ $totalIncl = new Varien_Object(array(
+ 'code' => 'subtotal_incl',
+ 'value' => $subtotalIncl,
+ 'base_value'=> $baseSubtotalIncl,
+ 'label' => $this->__('Subtotal (Incl.Tax)')
+ ));
+ $parent->addTotal($totalExcl, 'subtotal');
+ $parent->addTotal($totalIncl, 'subtotal_excl');
+ $parent->removeTotal('subtotal');
+ } elseif ($this->_config->displaySalesSubtotalInclTax($store)) {
+ $subtotalIncl = $this->_source->getSubtotalInclTax();
+ $baseSubtotalIncl= $this->_source->getBaseSubtotalInclTax();
+ if (!$subtotalIncl) {
+ $subtotalIncl = $this->_source->getSubtotal()
+ + $this->_source->getTaxAmount()
+ - $this->_source->getShippingTaxAmount();
+ }
+ if (!$baseSubtotalIncl) {
+ $baseSubtotalIncl = $this->_source->getBaseSubtotal()
+ + $this->_source->getBaseTaxAmount()
+ - $this->_source->getBaseShippingTaxAmount();
+ }
+
+ $total = $parent->getTotal('subtotal');
+ if ($total) {
+ $total->setValue($subtotalIncl);
+ $total->setBaseValue($baseSubtotalIncl);
+ }
+ }
+ return $this;
+ }
+
+ protected function _initShipping()
+ {
+ $store = $this->getStore();
+ $parent = $this->getParentBlock();
+ $shipping = $parent->getTotal('shipping');
+ if (!$shipping) {
+ return $this;
+ }
+
+ if ($this->_config->displaySalesShippingBoth($store)) {
+ $shipping = $this->_source->getShippingAmount();
+ $baseShipping = $this->_source->getBaseShippingAmount();
+ $shippingIncl = $shipping + $this->_source->getShippingTaxAmount();
+ $baseShippingIncl = $baseShipping + $this->_source->getBaseShippingTaxAmount();
+
+ $totalExcl = new Varien_Object(array(
+ 'code' => 'shipping',
+ 'value' => $shipping,
+ 'base_value'=> $baseShipping,
+ 'label' => $this->__('Shipping & Handling (Excl.Tax)')
+ ));
+ $totalIncl = new Varien_Object(array(
+ 'code' => 'shipping_incl',
+ 'value' => $shippingIncl,
+ 'base_value'=> $baseShippingIncl,
+ 'label' => $this->__('Shipping & Handling (Incl.Tax)')
+ ));
+ $parent->addTotal($totalExcl, 'shipping');
+ $parent->addTotal($totalIncl, 'shipping');
+ $parent->removeTotal('shipping');
+ } elseif ($this->_config->displaySalesShippingInclTax($store)) {
+ $shippingIncl = $this->_source->getShippingAmount()
+ + $this->_source->getShippingTaxAmount();
+ $baseShippingIncl = $this->_source->getBaseShippingAmount()
+ + $this->_source->getBaseShippingTaxAmount();
+ $total = $parent->getTotal('shipping');
+ if ($total) {
+ $total->setValue($shippingIncl);
+ $total->setBaseValue($baseShippingIncl);
+ }
+ }
+ return $this;
+ }
+
+ protected function _initDiscount()
+ {
+// $store = $this->getStore();
+// $parent = $this->getParentBlock();
+// if ($this->_config->displaySales) {
+//
+// } elseif ($this->_config->displaySales) {
+//
+// }
+ }
+
+ protected function _initGrandTotal()
+ {
+ $store = $this->getStore();
+ $parent = $this->getParentBlock();
+ $grandototal = $parent->getTotal('grand_total');
+ if (!$grandototal || !(float)$this->_source->getGrandTotal()) {
+ return $this;
+ }
+
+ if ($this->_config->displaySalesTaxWithGrandTotal($store)) {
+ $grandtotal = $this->_source->getGrandTotal();
+ $baseGrandtotal = $this->_source->getBaseGrandTotal();
+ $grandtotalExcl = $grandtotal - $this->_source->getTaxAmount();
+ $baseGrandtotalExcl = $baseGrandtotal - $this->_source->getBaseTaxAmount();
+ $grandtotalExcl = max($grandtotalExcl, 0);
+ $baseGrandtotalExcl = max($baseGrandtotalExcl, 0);
+ $totalExcl = new Varien_Object(array(
+ 'code' => 'grand_total',
+ 'strong' => true,
+ 'value' => $grandtotalExcl,
+ 'base_value'=> $baseGrandtotalExcl,
+ 'label' => $this->__('Grand Total (Excl.Tax)')
+ ));
+ $totalIncl = new Varien_Object(array(
+ 'code' => 'grand_total_incl',
+ 'strong' => true,
+ 'value' => $grandtotal,
+ 'base_value'=> $baseGrandtotal,
+ 'label' => $this->__('Grand Total (Incl.Tax)')
+ ));
+ $parent->addTotal($totalExcl, 'grand_total');
+ $this->_addTax('grand_total');
+ $parent->addTotal($totalIncl, 'tax');
+ $parent->removeTotal('grand_total');
+ }
+ return $this;
+ }
+
+ public function getOrder()
+ {
+ return $this->_order;
+ }
+
+ public function getLabelProperties()
+ {
+ return $this->getParentBlock()->getLabelProperties();
+ }
+
+ public function getValueProperties()
+ {
+ return $this->getParentBlock()->getValueProperties();
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Helper/Data.php b/app/code/core/Mage/Tax/Helper/Data.php
index a37607d1f0..70d42e470a 100644
--- a/app/code/core/Mage/Tax/Helper/Data.php
+++ b/app/code/core/Mage/Tax/Helper/Data.php
@@ -32,8 +32,13 @@ class Mage_Tax_Helper_Data extends Mage_Core_Helper_Abstract
const PRICE_CONVERSION_PLUS = 1;
const PRICE_CONVERSION_MINUS = 2;
-
-
+ /**
+ * Tax configuration object
+ *
+ * @var Mage_Tax_Model_Config
+ */
+ protected $_config = null;
+ protected $_calculator = null;
protected $_displayTaxColumn;
protected $_taxData;
protected $_priceIncludesTax;
@@ -42,6 +47,41 @@ class Mage_Tax_Helper_Data extends Mage_Core_Helper_Abstract
protected $_priceDisplayType;
protected $_shippingPriceDisplayType;
+ public function __construct()
+ {
+ $this->_config = Mage::getSingleton('tax/config');
+ }
+
+ /**
+ * Get tax configuration object
+ *
+ * @return Mage_Tax_Model_Config
+ */
+ public function getConfig()
+ {
+ return $this->_config;
+ }
+
+ /**
+ * Get tax calculation object
+ *
+ * @return Mage_Tac_Model_Calculation
+ */
+ public function getCalculator()
+ {
+ if ($this->_calculator === null) {
+ $this->_calculator = Mage::getSingleton('tax/calculation');
+ }
+ return $this->_calculator;
+ }
+
+ /**
+ * Get product price including store convertion rate
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @param null|string $format
+ * @return float|string
+ */
public function getProductPrice($product, $format=null)
{
try {
@@ -62,14 +102,7 @@ public function getProductPrice($product, $format=null)
*/
public function priceIncludesTax($store=null)
{
- $storeId = Mage::app()->getStore($store)->getId();
- if (!isset($this->_priceIncludesTax[$storeId])) {
- $this->_priceIncludesTax[$storeId] = (int)Mage::getStoreConfig(
- Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX,
- $store
- );
- }
- return $this->_priceIncludesTax[$storeId];
+ return $this->_config->priceIncludesTax($store);
}
/**
@@ -80,14 +113,7 @@ public function priceIncludesTax($store=null)
*/
public function applyTaxAfterDiscount($store=null)
{
- $storeId = Mage::app()->getStore($store)->getId();
- if (!isset($this->_applyTaxAfterDiscount[$storeId])) {
- $this->_applyTaxAfterDiscount[$storeId] = (int)Mage::getStoreConfig(
- Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT,
- $store
- );
- }
- return $this->_applyTaxAfterDiscount[$storeId];
+ return $this->_config->applyTaxAfterDiscount($store);
}
/**
@@ -106,7 +132,7 @@ public function getIncExcText($flag, $store=null)
}
/**
- * Get product price display tax
+ * Get product price display type
* 1 - Excluding tax
* 2 - Including tax
* 3 - Both
@@ -116,14 +142,7 @@ public function getIncExcText($flag, $store=null)
*/
public function getPriceDisplayType($store = null)
{
- $storeId = Mage::app()->getStore($store)->getId();
- if (!isset($this->_priceDisplayType[$storeId])) {
- $this->_priceDisplayType[$storeId] = (int)Mage::getStoreConfig(
- Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE,
- $store
- );
- }
- return $this->_priceDisplayType[$storeId];
+ return $this->_config->getPriceDisplayType($store);
}
/**
@@ -141,7 +160,6 @@ public function needPriceConversion($store = null)
case Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX:
case Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH:
return self::PRICE_CONVERSION_MINUS;
-
case Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX:
$res = false;
}
@@ -150,7 +168,6 @@ public function needPriceConversion($store = null)
case Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX:
case Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH:
return self::PRICE_CONVERSION_PLUS;
-
case Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX:
$res = false;
}
@@ -170,7 +187,7 @@ public function needPriceConversion($store = null)
*/
public function displayFullSummary($store = null)
{
- return ((int)Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DISPLAY_FULL_SUMMARY, $store) == 1);
+ return $this->_config->displayCartFullSummary($store);
}
/**
@@ -181,7 +198,7 @@ public function displayFullSummary($store = null)
*/
public function displayZeroTax($store = null)
{
- return Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DISPLAY_ZERO_TAX, $store);
+ return $this->_config->displayCartZeroTax($store);
}
/**
@@ -192,7 +209,7 @@ public function displayZeroTax($store = null)
*/
public function displayCartPriceInclTax($store = null)
{
- return $this->displayTaxColumn($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX;
+ return $this->_config->displayCartPricesInclTax($store);
}
/**
@@ -203,7 +220,7 @@ public function displayCartPriceInclTax($store = null)
*/
public function displayCartPriceExclTax($store = null)
{
- return $this->displayTaxColumn($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX;
+ return $this->_config->displayCartPricesExclTax($store);
}
/**
@@ -214,7 +231,74 @@ public function displayCartPriceExclTax($store = null)
*/
public function displayCartBothPrices($store = null)
{
- return $this->displayTaxColumn($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_BOTH;
+ return $this->_config->displayCartPricesBoth($store);
+ }
+
+ /**
+ * Check if need display order prices included tax
+ *
+ * @param mixed $store
+ * @return bool
+ */
+ public function displaySalesPriceInclTax($store = null)
+ {
+ return $this->_config->displaySalesPricesInclTax($store);
+ }
+
+ /**
+ * Check if need display order prices excluding price
+ *
+ * @param mixed $store
+ * @return bool
+ */
+ public function displaySalesPriceExclTax($store = null)
+ {
+ return $this->_config->displaySalesPricesExclTax($store);
+ }
+
+ /**
+ * Check if need display order prices excluding and including tax
+ *
+ * @param mixed $store
+ * @return bool
+ */
+ public function displaySalesBothPrices($store = null)
+ {
+ return $this->_config->displaySalesPricesBoth($store);
+ }
+
+
+ /**
+ * Check if we need display price include and exclude tax for order/invoice subtotal
+ *
+ * @param mixed $store
+ * @return bool
+ */
+ public function displaySalesSubtotalBoth($store = null)
+ {
+ return $this->_config->displaySalesSubtotalBoth($store);
+ }
+
+ /**
+ * Check if we need display price include tax for order/invoice subtotal
+ *
+ * @param mixed $store
+ * @return bool
+ */
+ public function displaySalesSubtotalInclTax($store = null)
+ {
+ return $this->_config->displaySalesSubtotalInclTax($store);
+ }
+
+ /**
+ * Check if we need display price exclude tax for order/invoice subtotal
+ *
+ * @param mixed $store
+ * @return bool
+ */
+ public function displaySalesSubtotalExclTax($store = null)
+ {
+ return $this->_config->displaySalesSubtotalExclTax($store);
}
/**
@@ -225,10 +309,7 @@ public function displayCartBothPrices($store = null)
*/
public function displayTaxColumn($store = null)
{
- if (is_null($this->_displayTaxColumn)) {
- $this->_displayTaxColumn = (int)Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DISPLAY_TAX_COLUMN, $store);
- }
- return $this->_displayTaxColumn;
+ return $this->_config->displayCartPricesBoth();
}
/**
@@ -239,7 +320,7 @@ public function displayTaxColumn($store = null)
*/
public function getPriceFormat($store = null)
{
- return Zend_Json::encode(Mage::app()->getLocale()->getJsPriceFormat());
+ return Mage::helper('core')->jsonEncode(Mage::app()->getLocale()->getJsPriceFormat());
}
/**
@@ -261,7 +342,7 @@ public function getTaxRatesByProductClass()
$result["value_{$class}"] = $rate;
}
- return Zend_Json::encode($result);
+ return Mage::helper('core')->jsonEncode($result);
}
/**
@@ -313,8 +394,14 @@ public function getPrice($product, $price, $includingTax = null, $shippingAddres
if (!is_null($includingTax)) {
if ($priceIncludesTax) {
if ($includingTax) {
- $price = $this->_calculatePrice($price, $includingPercent, false);
- $price = $this->_calculatePrice($price, $percent, true);
+ /**
+ * Recalculate price include tax in case of different rates
+ */
+ if ($includingPercent != $percent) {
+ $price = $this->_calculatePrice($price, $includingPercent, false);
+ $price = $this->getCalculator()->roundUp($price);
+ $price = $this->_calculatePrice($price, $percent, true);
+ }
} else {
$price = $this->_calculatePrice($price, $includingPercent, false);
}
@@ -348,7 +435,6 @@ public function getPrice($product, $price, $includingTax = null, $shippingAddres
}
}
}
-
return $store->roundPrice($price);
}
@@ -373,7 +459,7 @@ protected function _calculatePrice($price, $percent, $type)
if ($type) {
return $price * (1+($percent/100));
} else {
- return $price - ($price/(100+$percent)*$percent);
+ return $price/(1+$percent/100);
}
}
@@ -385,23 +471,12 @@ public function getIncExcTaxLabel($flag)
public function shippingPriceIncludesTax($store = null)
{
- $storeId = Mage::app()->getStore($store)->getId();
- if (!isset($this->_shippingPriceIncludesTax[$storeId])) {
- $this->_shippingPriceIncludesTax[$storeId] =
- (int)Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX, $store);
- }
- return $this->_shippingPriceIncludesTax[$storeId];
+ return $this->_config->shippingPriceIncludesTax($store);
}
public function getShippingPriceDisplayType($store = null)
{
-
- $storeId = Mage::app()->getStore($store)->getId();
- if (!isset($this->_shippingPriceDisplayType[$storeId])) {
- $this->_shippingPriceDisplayType[$storeId] =
- (int)Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DISPLAY_SHIPPING, $store);
- }
- return $this->_shippingPriceDisplayType[$storeId];
+ return $this->_config->getShippingPriceDisplayType($store);
}
public function displayShippingPriceIncludingTax()
@@ -421,10 +496,16 @@ public function displayShippingBothPrices()
public function getShippingTaxClass($store)
{
- return (int)Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, $store);
+ return $this->_config->getShippingTaxClass($store);
}
- public function getShippingPrice($price, $includingTax = null, $shippingAddress = null, $ctc = null, $store = null){
+ /**
+ * Get shipping price
+ *
+ * @return float
+ */
+ public function getShippingPrice($price, $includingTax = null, $shippingAddress = null, $ctc = null, $store = null)
+ {
$pseudoProduct = new Varien_Object();
$pseudoProduct->setTaxClassId($this->getShippingTaxClass($store));
@@ -433,7 +514,17 @@ public function getShippingPrice($price, $includingTax = null, $shippingAddress
$billingAddress = $shippingAddress->getQuote()->getBillingAddress();
}
- return $this->getPrice($pseudoProduct, $price, $includingTax, $shippingAddress, $billingAddress, $ctc, $store, $this->shippingPriceIncludesTax($store));
+ $price = $this->getPrice(
+ $pseudoProduct,
+ $price,
+ $includingTax,
+ $shippingAddress,
+ $billingAddress,
+ $ctc,
+ $store,
+ $this->shippingPriceIncludesTax($store)
+ );
+ return $price;
}
public function getPriceTaxSql($priceField, $taxClassField)
@@ -502,9 +593,15 @@ public function joinTaxClass($select, $storeId, $priceTable='main_table')
array());
}
+ /**
+ * Get configuration setting "Apply Discount On Prices Including Tax" value
+ *
+ * @param null|int $store
+ * @return 0|1
+ */
public function discountTax($store=null)
{
- return ((int)Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DISCOUNT_TAX, $store) == 1);
+ return $this->_config->discountTax($store);
}
public function getTaxBasedOn($store = null)
@@ -512,11 +609,37 @@ public function getTaxBasedOn($store = null)
return Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_BASED_ON, $store);
}
- public function applyTaxOnCustomPrice($store = null) {
- return ((int) Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_BASED_ON, $store) == 0);
+ public function applyTaxOnCustomPrice($store = null)
+ {
+ return ((int) Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_ON, $store) == 0);
+ }
+
+ public function applyTaxOnOriginalPrice($store = null)
+ {
+ return ((int) Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_APPLY_ON, $store) == 1);
}
- public function applyTaxOnOriginalPrice($store = null) {
- return ((int) Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_BASED_ON, $store) == 1);
+ /**
+ * Get taxes/discounts calculation sequence.
+ * This sequence depends on "Catalog price include tax", "Apply Tax After Discount"
+ * and "Apply Discount On Prices Including Tax" configuration options.
+ *
+ * @param null|int|string|Mage_Core_Model_Store $store
+ * @return string
+ */
+ public function getCalculationSequence($store=null)
+ {
+ return $this->_config->getCalculationSequence($store);
+ }
+
+ /**
+ * Get tax caclulation algorithm code
+ *
+ * @param null|int $store
+ * @return string
+ */
+ public function getCalculationAgorithm($store=null)
+ {
+ return $this->_config->getAlgorithm($store);
}
}
diff --git a/app/code/core/Mage/Tax/Model/Calculation.php b/app/code/core/Mage/Tax/Model/Calculation.php
index 062faa80d3..c2d78d735a 100644
--- a/app/code/core/Mage/Tax/Model/Calculation.php
+++ b/app/code/core/Mage/Tax/Model/Calculation.php
@@ -31,40 +31,115 @@
*/
class Mage_Tax_Model_Calculation extends Mage_Core_Model_Abstract
{
- protected $_rates = array();
- protected $_ctc = array();
- protected $_ptc = array();
+ const CALC_TAX_BEFORE_DISCOUNT_ON_EXCL = '0_0';
+ const CALC_TAX_BEFORE_DISCOUNT_ON_INCL = '0_1';
+ const CALC_TAX_AFTER_DISCOUNT_ON_EXCL = '1_0';
+ const CALC_TAX_AFTER_DISCOUNT_ON_INCL = '1_1';
+
+ const CALC_UNIT_BASE = 'UNIT_BASE_CALCULATION';
+ const CALC_ROW_BASE = 'ROW_BASE_CALCULATION';
+ const CALC_TOTAL_BASE = 'TOTAL_BASE_CALCULATION';
+
+ protected $_rates = array();
+ protected $_ctc = array();
+ protected $_ptc = array();
protected $_rateCache = array();
protected $_rateCalculationProcess = array();
+ protected $_customer = null;
+ protected $_defaultCustomerTaxClass = null;
+
protected function _construct()
{
$this->_init('tax/calculation');
}
+ /**
+ * Specify customer object which can be used for rate calculation
+ *
+ * @param Mage_Customer_Model_Customer $customer
+ * @return Mage_Tax_Model_Calculation
+ */
+ public function setCustomer(Mage_Customer_Model_Customer $customer)
+ {
+ $this->_customer = $customer;
+ return $this;
+ }
+
+ public function getDefaultCustomerTaxClass($store=null)
+ {
+ if ($this->_defaultCustomerTaxClass === null) {
+ $defaultCustomerGroup = Mage::getStoreConfig('customer/create_account/default_group', $store);
+ $this->_defaultCustomerTaxClass = Mage::getModel('customer/group')->getTaxClassId($defaultCustomerGroup);
+ }
+ return $this->_defaultCustomerTaxClass;
+ }
+
+ /**
+ * Get customer object
+ *
+ * @return Mage_Tax_Model_Calculation | false
+ */
+ public function getCustomer()
+ {
+ if ($this->_customer === null) {
+ $session = Mage::getSingleton('customer/session');
+ if ($session->isLoggedIn()) {
+ $this->_customer = $session->getCustomer();
+ } else {
+ $this->_customer = false;
+ }
+ }
+ return $this->_customer;
+ }
+
+ /**
+ * Delete calculation settings by rule id
+ *
+ * @param int $ruleId
+ * @return Mage_Tax_Model_Calculation
+ */
public function deleteByRuleId($ruleId)
{
- $this->getResource()->deleteByRuleId($ruleId);
+ $this->_getResource()->deleteByRuleId($ruleId);
return $this;
}
+ /**
+ * Get calculation rates by rule id
+ *
+ * @param int $ruleId
+ * @return array
+ */
public function getRates($ruleId)
{
if (!isset($this->_rates[$ruleId])) {
- $this->_rates[$ruleId] = $this->getResource()->getDistinct('tax_calculation_rate_id', $ruleId);
+ $this->_rates[$ruleId] = $this->_getResource()->getDistinct('tax_calculation_rate_id', $ruleId);
}
return $this->_rates[$ruleId];
}
+ /**
+ * Get allowed customer tax classes by rule id
+ *
+ * @param int $ruleId
+ * @return array
+ */
public function getCustomerTaxClasses($ruleId)
{
if (!isset($this->_ctc[$ruleId])) {
- $this->_ctc[$ruleId] = $this->getResource()->getDistinct('customer_tax_class_id', $ruleId);
+ $this->_ctc[$ruleId] = $this->_getResource()->getDistinct('customer_tax_class_id', $ruleId);
}
return $this->_ctc[$ruleId];
}
+ /**
+ * Get allowed product tax classes by rule id
+ *
+ * @param int $ruleId
+ * @return array
+ */
public function getProductTaxClasses($ruleId)
{
if (!isset($this->_ptc[$ruleId])) {
@@ -73,6 +148,11 @@ public function getProductTaxClasses($ruleId)
return $this->_ptc[$ruleId];
}
+ /**
+ * Aggregate tax calculation data to array
+ *
+ * @return array
+ */
protected function _formCalculationProcess()
{
$title = $this->getRateTitle();
@@ -89,13 +169,21 @@ protected function _formCalculationProcess()
return array($process);
}
+ /**
+ * Get calculation tax rate by specific request
+ *
+ * @param Varien_Object $request
+ * @return float
+ */
public function getRate($request)
{
if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
return 0;
}
- $cacheKey = "{$request->getProductClassId()}|{$request->getCustomerClassId()}|{$request->getCountryId()}|{$request->getRegionId()}|{$request->getPostcode()}";
+ $cacheKey = $request->getProductClassId() . '|' . $request->getCustomerClassId() . '|'
+ . $request->getCountryId() . '|' . $request->getRegionId() . '|' . $request->getPostcode();
+
if (!isset($this->_rateCache[$cacheKey])) {
$this->unsRateValue();
$this->unsCalculationProcess();
@@ -113,20 +201,71 @@ public function getRate($request)
return $this->_rateCache[$cacheKey];
}
+ /**
+ * Get tax rate based on store shipping origin address settings
+ * This rate can be used for conversion store price including tax to
+ * store price excluding tax
+ *
+ * @param Varien_Object $request
+ * @return float
+ */
+ public function getStoreRate($request, $store=null)
+ {
+ $storeRequest = $this->getRateOriginRequest($store)
+ ->setProductClassId($request->getProductClassId());
+ return $this->getRate($storeRequest);
+ }
+
+ /**
+ * Get request object for getting tax rate based on store shippig original address
+ *
+ * @param null|store $store
+ * @return Varien_Object
+ */
+ public function getRateOriginRequest($store=null)
+ {
+ $request = new Varien_Object();
+ $request->setCountryId(Mage::getStoreConfig('shipping/origin/country_id', $store))
+ ->setRegionId(Mage::getStoreConfig('shipping/origin/region_id', $store))
+ ->setPostcode(Mage::getStoreConfig('shipping/origin/postcode', $store))
+ ->setCustomerClassId($this->getDefaultCustomerTaxClass($store))
+ ->setStore($store);
+ return $request;
+ }
+
+ /**
+ * Get request object with information necessary for getting tax rate
+ * Request object contain:
+ * country_id (->getCountryId())
+ * region_id (->getRegionId())
+ * postcode (->getPostcode())
+ * customer_class_id (->getCustomerClassId())
+ * store (->getStore())
+ *
+ * @param null|false|Varien_Object $shippingAddress
+ * @param null|false|Varien_Object $billingAddress
+ * @param null|int $customerTaxClass
+ * @param null|int $store
+ * @return Varien_Object
+ */
public function getRateRequest($shippingAddress = null, $billingAddress = null, $customerTaxClass = null, $store = null)
{
- $address = new Varien_Object();
- $session = Mage::getSingleton('customer/session');
- $basedOn = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_BASED_ON, $store);
- if (($shippingAddress === false && $basedOn == 'shipping') || ($billingAddress === false && $basedOn == 'billing')) {
+ if ($shippingAddress === false && $billingAddress === false && $customerTaxClass === false) {
+ return $this->getRateOriginRequest($store);
+ }
+ $address = new Varien_Object();
+ $customer = $this->getCustomer();
+ $basedOn = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_BASED_ON, $store);
+
+ if (($shippingAddress === false && $basedOn == 'shipping')
+ || ($billingAddress === false && $basedOn == 'billing')) {
$basedOn = 'default';
} else {
- if ((($billingAddress === false || is_null($billingAddress) || !$billingAddress->getCountryId()) && $basedOn == 'billing') || (($shippingAddress === false || is_null($shippingAddress) || !$shippingAddress->getCountryId()) && $basedOn == 'shipping')){
- if (!$session->isLoggedIn()) {
- $basedOn = 'default';
- } else {
- $defBilling = $session->getCustomer()->getDefaultBillingAddress();
- $defShipping = $session->getCustomer()->getDefaultShippingAddress();
+ if ((($billingAddress === false || is_null($billingAddress) || !$billingAddress->getCountryId()) && $basedOn == 'billing')
+ || (($shippingAddress === false || is_null($shippingAddress) || !$shippingAddress->getCountryId()) && $basedOn == 'shipping')){
+ if ($customer) {
+ $defBilling = $customer->getDefaultBillingAddress();
+ $defShipping = $customer->getDefaultShippingAddress();
if ($basedOn == 'billing' && $defBilling && $defBilling->getCountryId()) {
$billingAddress = $defBilling;
@@ -135,6 +274,8 @@ public function getRateRequest($shippingAddress = null, $billingAddress = null,
} else {
$basedOn = 'default';
}
+ } else {
+ $basedOn = 'default';
}
}
}
@@ -143,32 +284,25 @@ public function getRateRequest($shippingAddress = null, $billingAddress = null,
case 'billing':
$address = $billingAddress;
break;
-
case 'shipping':
$address = $shippingAddress;
break;
-
case 'origin':
- $address
- ->setCountryId(Mage::getStoreConfig('shipping/origin/country_id', $store))
- ->setRegionId(Mage::getStoreConfig('shipping/origin/region_id', $store))
- ->setPostcode(Mage::getStoreConfig('shipping/origin/postcode', $store));
+ $address = $this->getRateOriginRequest($store);
break;
-
case 'default':
- $address
- ->setCountryId(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, $store))
+ $address->setCountryId(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, $store))
->setRegionId(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_REGION, $store))
->setPostcode(Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_DEFAULT_POSTCODE, $store));
break;
}
- if (is_null($customerTaxClass) && $session->isLoggedIn()) {
- $customerTaxClass = $session->getCustomer()->getTaxClassId();
- } elseif (($customerTaxClass === false) || !$session->isLoggedIn()) {
- $defaultCustomerGroup = Mage::getStoreConfig('customer/create_account/default_group', $store);
- $customerTaxClass = Mage::getModel('customer/group')->getTaxClassId($defaultCustomerGroup);
+ if (is_null($customerTaxClass) && $customer) {
+ $customerTaxClass = $customer->getTaxClassId();
+ } elseif (($customerTaxClass === false) || !$customer) {
+ $customerTaxClass = $this->getDefaultCustomerTaxClass($store);
}
+
$request = new Varien_Object();
$request
->setCountryId($address->getCountryId())
@@ -179,6 +313,24 @@ public function getRateRequest($shippingAddress = null, $billingAddress = null,
return $request;
}
+ /**
+ * Compare data from two tax rate requests.
+ * Return true if requests are semilar
+ *
+ * @param Varien_Object $first
+ * @param Varien_Object $second
+ * @return bool
+ */
+ public function compareRequests($first, $second)
+ {
+ if ($first->getCountryId() == $second->getCountryId() && $first->getRegionId() == $second->getRegionId()
+ && $first->getPostcode() == $second->getPostcode()
+ && $first->getCustomerClassId() == $second->getCustomerClassId()) {
+ return true;
+ }
+ return false;
+ }
+
protected function _getRates($request, $fieldName, $type)
{
$result = array();
@@ -202,9 +354,18 @@ public function getRatesForAllCustomerTaxClasses($request)
return $this->_getRates($request, 'customer_class_id', 'CUSTOMER');
}
+ /**
+ * Get information about tax rates applied to request
+ *
+ * @param Varien_Object $request
+ * @return array
+ */
public function getAppliedRates($request)
{
- $cacheKey = "{$request->getStore()->getId()}|{$request->getProductClassId()}|{$request->getCustomerClassId()}|{$request->getCountryId()}|{$request->getRegionId()}|{$request->getPostcode()}";
+ $cacheKey = $request->getStore()->getId() . '|' . $request->getProductClassId() . '|'
+ . $request->getCustomerClassId() . '|' . $request->getCountryId() . '|'
+ . $request->getRegionId() . '|' . $request->getPostcode();
+
if (!isset($this->_rateCalculationProcess[$cacheKey])) {
$this->_rateCalculationProcess[$cacheKey] = $this->_getResource()->getCalculationProcess($request);
}
@@ -225,4 +386,72 @@ public function getRatesByCustomerAndProductTaxClasses($customerTaxClass, $produ
{
return $this->getResource()->getRatesByCustomerTaxClass($customerTaxClass, $productTaxClass);
}
+
+ /**
+ * Calculate rated tax abount based on price and tax rate.
+ * If you are using price including tax $priceIncludeTax should be true.
+ * $taxRate can't be more than 1 (if it is not percent)
+ *
+ * @param float $price
+ * @param float $taxRate
+ * @param boolean $priceIncludeTax
+ * @return float
+ */
+ public function calcTaxAmount($price, $taxRate, $priceIncludeTax=false, $round=true)
+ {
+ /**
+ * $taxRate can be more than 1 if somebody use tax percent
+ */
+ if ($taxRate>1) {
+ $taxRate = $taxRate/100;
+ }
+
+ if ($priceIncludeTax) {
+ $amount = $price*(1-1/(1+$taxRate));
+ } else {
+ $amount = $price*$taxRate;
+ }
+
+ if ($round) {
+ return $this->round($amount);
+ } else {
+ return $amount;
+ }
+ }
+
+ /**
+ * Truncate number to specified precision
+ *
+ * @param float $price
+ * @param int $precision
+ * @return float
+ */
+ public function truncate($price, $precision=4)
+ {
+ $exp = pow(10,$precision);
+ $price = floor($price*$exp)/$exp;
+ return $price;
+ }
+
+ /**
+ * Round tax amount
+ *
+ * @param float $price
+ * @return float
+ */
+ public function round($price)
+ {
+ return Mage::app()->getStore()->roundPrice($price);
+ }
+
+ /**
+ * Round price up
+ *
+ * @param float $price
+ * @return float
+ */
+ public function roundUp($price)
+ {
+ return ceil($price*100)/100;
+ }
}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Model/Config.php b/app/code/core/Mage/Tax/Model/Config.php
index 23c1ba0a8b..71e0f29aa5 100644
--- a/app/code/core/Mage/Tax/Model/Config.php
+++ b/app/code/core/Mage/Tax/Model/Config.php
@@ -40,25 +40,43 @@ class Mage_Tax_Model_Config
const CONFIG_XML_PATH_PRICE_INCLUDES_TAX = 'tax/calculation/price_includes_tax';
const CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX = 'tax/calculation/shipping_includes_tax';
const CONFIG_XML_PATH_BASED_ON = 'tax/calculation/based_on';
+ CONST CONFIG_XML_PATH_APPLY_ON = 'tax/calculation/apply_tax_on';
const CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT = 'tax/calculation/apply_after_discount';
const CONFIG_XML_PATH_DISCOUNT_TAX = 'tax/calculation/discount_tax';
+ const XML_PATH_ALGORITHM = 'tax/calculation/algorithm';
// tax defaults
const CONFIG_XML_PATH_DEFAULT_COUNTRY = 'tax/defaults/country';
const CONFIG_XML_PATH_DEFAULT_REGION = 'tax/defaults/region';
const CONFIG_XML_PATH_DEFAULT_POSTCODE = 'tax/defaults/postcode';
- // tax display
- const CONFIG_XML_PATH_PRICE_DISPLAY_TYPE = 'tax/display/type';
- const CONFIG_XML_PATH_DISPLAY_TAX_COLUMN = 'tax/display/column_in_summary';
- const CONFIG_XML_PATH_DISPLAY_FULL_SUMMARY = 'tax/display/full_summary';
- const CONFIG_XML_PATH_DISPLAY_SHIPPING = 'tax/display/shipping';
- const CONFIG_XML_PATH_DISPLAY_ZERO_TAX = 'tax/display/zero_tax';
+ /**
+ * Prices display settings
+ */
+ const CONFIG_XML_PATH_PRICE_DISPLAY_TYPE = 'tax/display/type';
+ const CONFIG_XML_PATH_DISPLAY_SHIPPING = 'tax/display/shipping';
- // deprecated settings
- const CONFIG_XML_PATH_SHOW_IN_CATALOG = 'tax/display/show_in_catalog';
- const CONFIG_XML_PATH_DEFAULT_PRODUCT_TAX_GROUP = 'catalog/product/default_tax_group';
+ /**
+ * Shopping cart display settings
+ */
+ const XML_PATH_DISPLAY_CART_PRICE = 'tax/cart_display/price';
+ const XML_PATH_DISPLAY_CART_SUBTOTAL = 'tax/cart_display/subtotal';
+ const XML_PATH_DISPLAY_CART_SHIPPING = 'tax/cart_display/shipping';
+ const XML_PATH_DISPLAY_CART_DISCOUNT = 'tax/cart_display/discount';
+ const XML_PATH_DISPLAY_CART_GRANDTOTAL = 'tax/cart_display/grandtotal';
+ const XML_PATH_DISPLAY_CART_FULL_SUMMARY= 'tax/cart_display/full_summary';
+ const XML_PATH_DISPLAY_CART_ZERO_TAX = 'tax/cart_display/zero_tax';
+ /**
+ * Shopping cart display settings
+ */
+ const XML_PATH_DISPLAY_SALES_PRICE = 'tax/sales_display/price';
+ const XML_PATH_DISPLAY_SALES_SUBTOTAL = 'tax/sales_display/subtotal';
+ const XML_PATH_DISPLAY_SALES_SHIPPING = 'tax/sales_display/shipping';
+ const XML_PATH_DISPLAY_SALES_DISCOUNT = 'tax/sales_display/discount';
+ const XML_PATH_DISPLAY_SALES_GRANDTOTAL = 'tax/sales_display/grandtotal';
+ const XML_PATH_DISPLAY_SALES_FULL_SUMMARY= 'tax/sales_display/full_summary';
+ const XML_PATH_DISPLAY_SALES_ZERO_TAX = 'tax/sales_display/zero_tax';
const CALCULATION_STRING_SEPARATOR = '|';
@@ -66,5 +84,382 @@ class Mage_Tax_Model_Config
const DISPLAY_TYPE_INCLUDING_TAX = 2;
const DISPLAY_TYPE_BOTH = 3;
+ /**
+ * @deprecated
+ */
+ const CONFIG_XML_PATH_SHOW_IN_CATALOG = 'tax/display/show_in_catalog';
+ const CONFIG_XML_PATH_DEFAULT_PRODUCT_TAX_GROUP = 'catalog/product/default_tax_group';
+ const CONFIG_XML_PATH_DISPLAY_TAX_COLUMN = 'tax/display/column_in_summary';
+ const CONFIG_XML_PATH_DISPLAY_FULL_SUMMARY = 'tax/display/full_summary';
+ const CONFIG_XML_PATH_DISPLAY_ZERO_TAX = 'tax/display/zero_tax';
+
+ /**
+ * Flag which notify what we need use prices exclude tax for calculations
+ *
+ * @var bool
+ */
+ protected $_needUsePriceExcludeTax = false;
+
+ /**
+ * Flag which notify what we need use shipping prices exclude tax for calculations
+ *
+ * @var bool
+ */
+ protected $_needUseShippingExcludeTax = false;
+
+ /**
+ * Check if product prices inputed include tax
+ *
+ * @param mix $store
+ * @return bool
+ */
+ public function priceIncludesTax($store=null)
+ {
+ if ($this->_needUsePriceExcludeTax) {
+ return false;
+ }
+ return (bool)Mage::getStoreConfig(self::CONFIG_XML_PATH_PRICE_INCLUDES_TAX, $store);
+ }
+
+ /**
+ * Check what taxes should be applied after discount
+ *
+ * @param mixed $store
+ * @return bool
+ */
+ public function applyTaxAfterDiscount($store=null)
+ {
+ return (bool)Mage::getStoreConfig(self::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT, $store);
+ }
+
+ /**
+ * Get product price display type
+ * 1 - Excluding tax
+ * 2 - Including tax
+ * 3 - Both
+ *
+ * @param mixed $store
+ * @return int
+ */
+ public function getPriceDisplayType($store = null)
+ {
+ return (int)Mage::getStoreConfig(self::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE, $store);
+ }
+
+ /**
+ * Get configuration setting "Apply Discount On Prices Including Tax" value
+ *
+ * @param null|int $store
+ * @return 0|1
+ */
+ public function discountTax($store=null)
+ {
+ return ((int)Mage::getStoreConfig(self::CONFIG_XML_PATH_DISCOUNT_TAX, $store) == 1);
+ }
+
+ /**
+ * Get taxes/discounts calculation sequence.
+ * This sequence depends on "Apply Customer Tax" and "Apply Discount On Prices" configuration options.
+ *
+ * @param null|int|string|Mage_Core_Model_Store $store
+ * @return string
+ */
+ public function getCalculationSequence($store=null)
+ {
+ if ($this->applyTaxAfterDiscount($store)) {
+ if ($this->discountTax($store)) {
+ $seq = Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL;
+ } else {
+ $seq = Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL;
+ }
+ } else {
+ if ($this->discountTax($store)) {
+ $seq = Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL;
+ } else {
+ $seq = Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL;
+ }
+ }
+ return $seq;
+ }
+
+ /**
+ * Specify flag what we need use price exclude tax
+ *
+ * @param bool $flag
+ * @return Mage_Tax_Model_Config
+ */
+ public function setNeedUsePriceExcludeTax($flag)
+ {
+ $this->_needUsePriceExcludeTax = $flag;
+ return $this;
+ }
+
+ /**
+ * Get flag what we need use price exclude tax
+ *
+ * @return bool $flag
+ */
+ public function getNeedUsePriceExcludeTax()
+ {
+ return $this->_needUsePriceExcludeTax;
+ }
+
+ /**
+ * Specify flag what we need use shipping price exclude tax
+ *
+ * @param bool $flag
+ * @return Mage_Tax_Model_Config
+ */
+ public function setNeedUseShippingExcludeTax($flag)
+ {
+ $this->_needUseShippingExcludeTax = $flag;
+ return $this;
+ }
+
+ /**
+ * Get flag what we need use shipping price exclude tax
+ *
+ * @return bool $flag
+ */
+ public function getNeedUseShippingExcludeTax()
+ {
+ return $this->_needUseShippingExcludeTax;
+ }
+
+
+ /**
+ * Get defined tax calculation agorithm
+ *
+ * @param store $store
+ * @return string
+ */
+ public function getAlgorithm($store=null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_ALGORITHM, $store);
+ }
+
+ /**
+ * Get tax class id specified for shipping tax estimation
+ *
+ * @param store $store
+ * @return int
+ */
+ public function getShippingTaxClass($store=null)
+ {
+ return (int)Mage::getStoreConfig(self::CONFIG_XML_PATH_SHIPPING_TAX_CLASS, $store);
+ }
+
+ /**
+ * Get shipping methods prices display type
+ *
+ * @param store $store
+ * @return int
+ */
+ public function getShippingPriceDisplayType($store = null)
+ {
+ return (int)Mage::getStoreConfig(self::CONFIG_XML_PATH_DISPLAY_SHIPPING, $store);
+ }
+
+ /**
+ * Check if shiping prices include tax
+ *
+ * @param store $store
+ * @return bool
+ */
+ public function shippingPriceIncludesTax($store = null)
+ {
+ return (bool) Mage::getStoreConfig(self::CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX, $store);
+ }
+
+
+
+ /**
+ * Check if need display full tax summary information in totals block
+ *
+ * @deprecated please use displayCartFullSummary or displaySalesFullSummary
+ * @param mixed $store
+ * @return bool
+ */
+ public function displayFullSummary($store = null)
+ {
+ return $this->displayCartFullSummary($store);
+ }
+
+ /**
+ * Check if need display zero tax in subtotal
+ *
+ * @deprecated please use displayCartZeroTax or displaySalesZeroTax
+ * @param mixed $store
+ * @return bool
+ */
+ public function displayZeroTax($store = null)
+ {
+ return $this->displayCartZeroTax($store);
+ }
+
+ /**
+ * Get shopping cart prices display type
+ *
+ * @deprecated please use displayCartPrice or displaySalesZeroTax
+ * @param mixed $store
+ * @return bool
+ */
+ public function displayTaxColumn($store = null)
+ {
+ return (bool)Mage::getStoreConfig(self::CONFIG_XML_PATH_DISPLAY_TAX_COLUMN, $store);
+ }
+
+
+
+
+ public function displayCartPricesInclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_PRICE, $store) == self::DISPLAY_TYPE_INCLUDING_TAX;
+ }
+
+ public function displayCartPricesExclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_PRICE, $store) == self::DISPLAY_TYPE_EXCLUDING_TAX;
+ }
+
+ public function displayCartPricesBoth($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_PRICE, $store) == self::DISPLAY_TYPE_BOTH;
+ }
+
+ public function displayCartSubtotalInclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_SUBTOTAL, $store) == self::DISPLAY_TYPE_INCLUDING_TAX;
+ }
+
+ public function displayCartSubtotalExclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_SUBTOTAL, $store) == self::DISPLAY_TYPE_EXCLUDING_TAX;
+ }
+
+ public function displayCartSubtotalBoth($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_SUBTOTAL, $store) == self::DISPLAY_TYPE_BOTH;
+ }
+
+ public function displayCartShippingInclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_SHIPPING, $store) == self::DISPLAY_TYPE_INCLUDING_TAX;
+ }
+
+ public function displayCartShippingExclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_SHIPPING, $store) == self::DISPLAY_TYPE_EXCLUDING_TAX;
+ }
+
+ public function displayCartShippingBoth($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_SHIPPING, $store) == self::DISPLAY_TYPE_BOTH;
+ }
+
+ public function displayCartDiscountInclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_DISCOUNT, $store) == self::DISPLAY_TYPE_INCLUDING_TAX;
+ }
+
+ public function displayCartDiscountExclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_DISCOUNT, $store) == self::DISPLAY_TYPE_EXCLUDING_TAX;
+ }
+
+ public function displayCartDiscountBoth($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_DISCOUNT, $store) == self::DISPLAY_TYPE_BOTH;
+ }
+
+ public function displayCartTaxWithGrandTotal($store = null)
+ {
+ return (bool)Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_GRANDTOTAL, $store);
+ }
+
+ public function displayCartFullSummary($store = null)
+ {
+ return (bool)Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_FULL_SUMMARY, $store);
+ }
+
+ public function displayCartZeroTax($store = null)
+ {
+ return (bool)Mage::getStoreConfig(self::XML_PATH_DISPLAY_CART_ZERO_TAX, $store);
+ }
+
+
+ public function displaySalesPricesInclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_PRICE, $store) == self::DISPLAY_TYPE_INCLUDING_TAX;
+ }
+
+ public function displaySalesPricesExclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_PRICE, $store) == self::DISPLAY_TYPE_EXCLUDING_TAX;
+ }
+
+ public function displaySalesPricesBoth($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_PRICE, $store) == self::DISPLAY_TYPE_BOTH;
+ }
+
+ public function displaySalesSubtotalInclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_SUBTOTAL, $store) == self::DISPLAY_TYPE_INCLUDING_TAX;
+ }
+
+ public function displaySalesSubtotalExclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_SUBTOTAL, $store) == self::DISPLAY_TYPE_EXCLUDING_TAX;
+ }
+
+ public function displaySalesSubtotalBoth($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_SUBTOTAL, $store) == self::DISPLAY_TYPE_BOTH;
+ }
+
+ public function displaySalesShippingInclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_SHIPPING, $store) == self::DISPLAY_TYPE_INCLUDING_TAX;
+ }
+
+ public function displaySalesShippingExclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_SHIPPING, $store) == self::DISPLAY_TYPE_EXCLUDING_TAX;
+ }
+
+ public function displaySalesShippingBoth($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_SHIPPING, $store) == self::DISPLAY_TYPE_BOTH;
+ }
+
+ public function displaySalesDiscountInclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_DISCOUNT, $store) == self::DISPLAY_TYPE_INCLUDING_TAX;
+ }
+
+ public function displaySalestDiscountExclTax($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_DISCOUNT, $store) == self::DISPLAY_TYPE_EXCLUDING_TAX;
+ }
+
+ public function displaySalesDiscountBoth($store = null)
+ {
+ return Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_DISCOUNT, $store) == self::DISPLAY_TYPE_BOTH;
+ }
+
+ public function displaySalesTaxWithGrandTotal($store = null)
+ {
+ return (bool)Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_GRANDTOTAL, $store);
+ }
+
+ public function displaySalesFullSummary($store = null)
+ {
+ return (bool)Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_FULL_SUMMARY, $store);
+ }
+ public function displaySalesZeroTax($store = null)
+ {
+ return (bool)Mage::getStoreConfig(self::XML_PATH_DISPLAY_SALES_ZERO_TAX, $store);
+ }
}
diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Calculation.php b/app/code/core/Mage/Tax/Model/Mysql4/Calculation.php
index 040a79f837..17d562d3b5 100644
--- a/app/code/core/Mage/Tax/Model/Mysql4/Calculation.php
+++ b/app/code/core/Mage/Tax/Model/Mysql4/Calculation.php
@@ -36,6 +36,11 @@ protected function _construct()
$this->_setMainTable('tax/tax_calculation');
}
+ /**
+ * Delete calculation settings by rule id
+ *
+ * @param int $ruleId
+ */
public function deleteByRuleId($ruleId)
{
$conn = $this->_getWriteAdapter();
@@ -46,7 +51,8 @@ public function deleteByRuleId($ruleId)
public function getDistinct($field, $ruleId)
{
$select = $this->_getReadAdapter()->select();
- $select->from($this->getMainTable(), $field)->where('tax_calculation_rule_id = ?', $ruleId);
+ $select->from($this->getMainTable(), $field)
+ ->where('tax_calculation_rule_id = ?', $ruleId);
return $this->_getReadAdapter()->fetchCol($select);
}
@@ -239,5 +245,4 @@ public function getRatesByCustomerTaxClass($customerTaxClass, $productTaxClass =
return $result;
}
-
}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Calculation/Rule/Collection.php b/app/code/core/Mage/Tax/Model/Mysql4/Calculation/Rule/Collection.php
index 623e2f2edb..b98667a6e3 100644
--- a/app/code/core/Mage/Tax/Model/Mysql4/Calculation/Rule/Collection.php
+++ b/app/code/core/Mage/Tax/Model/Mysql4/Calculation/Rule/Collection.php
@@ -39,7 +39,11 @@ protected function _construct()
public function joinCalculationData($alias)
{
- $this->getSelect()->joinLeft(array($alias=>$this->getTable('tax_calculation')), "main_table.tax_calculation_rule_id = {$alias}.tax_calculation_rule_id", array());
+ $this->getSelect()->joinLeft(
+ array($alias=>$this->getTable('tax_calculation')),
+ "main_table.tax_calculation_rule_id = {$alias}.tax_calculation_rule_id",
+ array()
+ );
$this->getSelect()->group('main_table.tax_calculation_rule_id');
}
@@ -51,22 +55,27 @@ protected function _add($itemTable, $primaryJoinField, $secondaryJoinField, $tit
}
if (!empty($children)) {
$select = $this->getConnection()->select()
- ->from(array('calculation'=>$this->getTable('tax_calculation')), array('calculation.tax_calculation_rule_id'))
+ ->from(
+ array('calculation'=>$this->getTable('tax_calculation')),
+ array('calculation.tax_calculation_rule_id')
+ )
->join(
array('item'=>$this->getTable($itemTable)),
"item.{$secondaryJoinField} = calculation.{$primaryJoinField}",
- array("item.{$titleField}"))
+ array("item.{$titleField}", "item.{$secondaryJoinField}")
+ )
->where('calculation.tax_calculation_rule_id IN (?)', array_keys($children))
->distinct(true);
$data = $this->getConnection()->fetchAll($select);
foreach ($data as $row) {
- $children[$row['tax_calculation_rule_id']][] = $row[$titleField];
+ $children[$row['tax_calculation_rule_id']][$row[$secondaryJoinField]] = $row[$titleField];
}
}
+
foreach ($this as $rule) {
if (isset($children[$rule->getId()])) {
- $rule->setData($dataField, $children[$rule->getId()]);
+ $rule->setData($dataField, array_keys($children[$rule->getId()]));
}
}
return $this;
diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Setup.php b/app/code/core/Mage/Tax/Model/Mysql4/Setup.php
index 32a573b14e..db65310515 100644
--- a/app/code/core/Mage/Tax/Model/Mysql4/Setup.php
+++ b/app/code/core/Mage/Tax/Model/Mysql4/Setup.php
@@ -31,7 +31,7 @@
* @package Mage_Tax
* @author Magento Core Team
*/
-class Mage_Tax_Model_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
+class Mage_Tax_Model_Mysql4_Setup extends Mage_Sales_Model_Mysql4_Setup
{
/**
* Convert old Tax data
diff --git a/app/code/core/Mage/Tax/Model/Sales/Pdf/Grandtotal.php b/app/code/core/Mage/Tax/Model/Sales/Pdf/Grandtotal.php
new file mode 100644
index 0000000000..bab4041fa3
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/Sales/Pdf/Grandtotal.php
@@ -0,0 +1,72 @@
+ array(
+ * 'amount' => $amount,
+ * 'label' => $label,
+ * 'font_size'=> $font_size
+ * )
+ * )
+ * @return array
+ */
+ public function getTotalsForDisplay()
+ {
+ $store = $this->getOrder()->getStore();
+ $config= Mage::getSingleton('tax/config');
+ if (!$config->displaySalesTaxWithGrandTotal($store)) {
+ return parent::getTotalsForDisplay();
+ }
+ $amount = $this->getOrder()->formatPriceTxt($this->getAmount());
+ $amountExclTax = $this->getAmount()-$this->getSource()->getTaxAmount();
+ $amountExclTax = $this->getOrder()->formatPriceTxt($amountExclTax);
+ $tax = $this->getOrder()->formatPriceTxt($this->getSource()->getTaxAmount());
+ $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
+
+ $totals = array(
+ array(
+ 'amount' => $this->getAmountPrefix().$amountExclTax,
+ 'label' => Mage::helper('tax')->__('Grand Total (Excl. Tax)') . ':',
+ 'font_size' => $fontSize
+ ),
+ array(
+ 'amount' => $this->getAmountPrefix().$tax,
+ 'label' => Mage::helper('tax')->__('Tax') . ':',
+ 'font_size' => $fontSize
+ ),
+ array(
+ 'amount' => $this->getAmountPrefix().$amount,
+ 'label' => Mage::helper('tax')->__('Grand Total (Incl. Tax)') . ':',
+ 'font_size' => $fontSize
+ ),
+ );
+ return $totals;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Model/Sales/Pdf/Shipping.php b/app/code/core/Mage/Tax/Model/Sales/Pdf/Shipping.php
new file mode 100644
index 0000000000..d93bcaa453
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/Sales/Pdf/Shipping.php
@@ -0,0 +1,78 @@
+ array(
+ * 'amount' => $amount,
+ * 'label' => $label,
+ * 'font_size'=> $font_size
+ * )
+ * )
+ * @return array
+ */
+ public function getTotalsForDisplay()
+ {
+ $store = $this->getOrder()->getStore();
+ $config= Mage::getSingleton('tax/config');
+ $amount = $this->getOrder()->formatPriceTxt($this->getAmount());
+ $amountInclTax = $this->getAmount()+$this->getSource()->getShippingTaxAmount();
+ $amountInclTax = $this->getOrder()->formatPriceTxt($amountInclTax);
+ $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
+
+ if ($config->displaySalesShippingBoth($store)) {
+ $totals = array(
+ array(
+ 'amount' => $this->getAmountPrefix().$amount,
+ 'label' => Mage::helper('tax')->__('Shipping (Excl. Tax)') . ':',
+ 'font_size' => $fontSize
+ ),
+ array(
+ 'amount' => $this->getAmountPrefix().$amountInclTax,
+ 'label' => Mage::helper('tax')->__('Shipping (Incl. Tax)') . ':',
+ 'font_size' => $fontSize
+ ),
+ );
+ } elseif ($config->displaySalesShippingInclTax($store)) {
+ $totals = array(array(
+ 'amount' => $this->getAmountPrefix().$amountInclTax,
+ 'label' => Mage::helper('sales')->__($this->getTitle()) . ':',
+ 'font_size' => $fontSize
+ ));
+ } else {
+ $totals = array(array(
+ 'amount' => $this->getAmountPrefix().$amount,
+ 'label' => Mage::helper('sales')->__($this->getTitle()) . ':',
+ 'font_size' => $fontSize
+ ));
+ }
+
+ return $totals;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Model/Sales/Pdf/Subtotal.php b/app/code/core/Mage/Tax/Model/Sales/Pdf/Subtotal.php
new file mode 100644
index 0000000000..da47bf78f9
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/Sales/Pdf/Subtotal.php
@@ -0,0 +1,85 @@
+ array(
+ * 'amount' => $amount,
+ * 'label' => $label,
+ * 'font_size'=> $font_size
+ * )
+ * )
+ * @return array
+ */
+ public function getTotalsForDisplay()
+ {
+ $store = $this->getOrder()->getStore();
+ $helper= Mage::helper('tax');
+ $amount = $this->getOrder()->formatPriceTxt($this->getAmount());
+ if ($this->getSource()->getSubtotalInclTax()) {
+ $amountInclTax = $this->getSource()->getSubtotalInclTax();
+ } else {
+ $amountInclTax = $this->getAmount()
+ +$this->getSource()->getTaxAmount()
+ -$this->getSource()->getShippingTaxAmount();
+ }
+
+ $amountInclTax = $this->getOrder()->formatPriceTxt($amountInclTax);
+ $fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
+
+ if ($helper->displaySalesSubtotalBoth($store)) {
+ $totals = array(
+ array(
+ 'amount' => $this->getAmountPrefix().$amount,
+ 'label' => Mage::helper('tax')->__('Subtotal (Excl. Tax)') . ':',
+ 'font_size' => $fontSize
+ ),
+ array(
+ 'amount' => $this->getAmountPrefix().$amountInclTax,
+ 'label' => Mage::helper('tax')->__('Subtotal (Incl. Tax)') . ':',
+ 'font_size' => $fontSize
+ ),
+ );
+ } elseif ($helper->displaySalesSubtotalInclTax($store)) {
+ $totals = array(array(
+ 'amount' => $this->getAmountPrefix().$amountInclTax,
+ 'label' => Mage::helper('sales')->__($this->getTitle()) . ':',
+ 'font_size' => $fontSize
+ ));
+ } else {
+ $totals = array(array(
+ 'amount' => $this->getAmountPrefix().$amount,
+ 'label' => Mage::helper('sales')->__($this->getTitle()) . ':',
+ 'font_size' => $fontSize
+ ));
+ }
+
+ return $totals;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Model/Sales/Pdf/Tax.php b/app/code/core/Mage/Tax/Model/Sales/Pdf/Tax.php
new file mode 100644
index 0000000000..992c34c473
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/Sales/Pdf/Tax.php
@@ -0,0 +1,49 @@
+ array(
+ * 'amount' => $amount,
+ * 'label' => $label,
+ * 'font_size'=> $font_size
+ * )
+ * )
+ * @return array
+ */
+ public function getTotalsForDisplay()
+ {
+ $store = $this->getOrder()->getStore();
+ $config= Mage::getSingleton('tax/config');
+ if ($config->displaySalesTaxWithGrandTotal($store)) {
+ return array();
+ }
+ return parent::getTotalsForDisplay();
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Discount.php b/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Discount.php
new file mode 100644
index 0000000000..4e1e758d07
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Discount.php
@@ -0,0 +1,42 @@
+setCode('tax_subtotal');
+ $this->_calculator = Mage::getSingleton('tax/calculation');
+ $this->_config = Mage::getSingleton('tax/config');
+ }
+
+ /**
+ * Prepare subtotals calculations result before apply tax
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
+ */
+ public function collect(Mage_Sales_Model_Quote_Address $address)
+ {
+ if ($this->_needSubtractTax($address)) {
+ $address->setTotalAmount('subtotal', 0);
+ $address->setBaseTotalAmount('subtotal', 0);
+ $items = $address->getAllItems();
+
+ foreach ($items as $item) {
+ /**
+ * Child item's tax we calculate for parent - that why we skip them
+ */
+ if ($item->getParentItemId()) {
+ continue;
+ }
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
+ foreach ($item->getChildren() as $child) {
+ $this->_recollectItem($address, $child);
+ }
+ $this->_recalculateParent($item);
+ } else {
+ $this->_recollectItem($address, $item);
+ }
+ $this->_addSubtotalAmount($address, $item);
+ }
+ $address->setSubtotalInclTax($this->_subtotalInclTax);
+ $address->setBaseSubtotalInclTax($this->_baseSubtotalInclTax);
+ $this->_config->setNeedUsePriceExcludeTax(true);
+ }
+
+ if ($this->_needSubtractShippingTax($address)) {
+ $this->_processShippingAmount($address);
+ $this->_config->setNeedUseShippingExcludeTax(true);
+ }
+ return $this;
+ }
+
+ /**
+ * Get request for fetching store tax rate
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Varien_Object
+ */
+ protected function _getStoreTaxRequest($address)
+ {
+ if ($this->_storeTaxRequest === null) {
+ $this->_storeTaxRequest = $this->_calculator->getRateOriginRequest($address->getQuote()->getStore());
+ }
+ return $this->_storeTaxRequest;
+ }
+
+ /**
+ * Get request for fetching address tax rate
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Varien_Object
+ */
+ protected function _getAddressTaxRequest($address)
+ {
+ if ($this->_addressTaxRequest === null) {
+ $this->_addressTaxRequest = $this->_calculator->getRateRequest(
+ $address,
+ $address->getQuote()->getBillingAddress(),
+ $address->getQuote()->getCustomerTaxClassId(),
+ $address->getQuote()->getStore()
+ );
+ }
+ return $this->_addressTaxRequest;
+ }
+
+ /**
+ * Calculate shipping price without store tax
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
+ */
+ protected function _processShippingAmount($address)
+ {
+ $store = $address->getQuote()->getStore();
+ $shippingTaxClass = $this->_config->getShippingTaxClass($store);
+ $shippingAmount = $address->getShippingAmount();
+ $baseShippingAmount = $address->getBaseShippingAmount();
+
+ if ($shippingTaxClass) {
+ $request = $this->_getStoreTaxRequest($address);
+ $request->setProductClassId($shippingTaxClass);
+ $rate = $this->_calculator->getRate($request);
+ if ($rate) {
+ $shippingTax = $this->_calculator->calcTaxAmount($shippingAmount, $rate, true, false);
+ $shippingBaseTax= $this->_calculator->calcTaxAmount($baseShippingAmount, $rate, true, false);
+ $shippingAmount-= $shippingTax;
+ $baseShippingAmount-=$shippingBaseTax;
+ $address->setTotalAmount('shipping', $this->_calculator->roundUp($shippingAmount));
+ $address->setBaseTotalAmount('shipping', $this->_calculator->roundUp($baseShippingAmount));
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Recollect item price and row total using after taxes subtract.
+ * Declare item price including tax attributes
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
+ */
+ protected function _recollectItem($address, Mage_Sales_Model_Quote_Item_Abstract $item)
+ {
+ $store = $address->getQuote()->getStore();
+ $request = $this->_getStoreTaxRequest($address);
+ $request->setProductClassId($item->getProduct()->getTaxClassId());
+ $rate = $this->_calculator->getRate($request);
+ $qty = $item->getTotalQty();
+
+ $price = $item->getCalculationPrice();
+ $basePrice = $item->getBaseCalculationPrice();
+ $subtotal = $item->getRowTotal();
+ $baseSubtotal = $item->getBaseRowTotal();
+
+ if ($this->_config->discountTax($store)) {
+ $item->setDiscountCalculationPrice($price);
+ $item->setBaseDiscountCalculationPrice($basePrice);
+ }
+
+ $item->setRowTotalInclTax($subtotal);
+ $item->setBaseRowTotalInclTax($baseSubtotal);
+ $item->setPriceInclTax($price);
+ $item->setBasePriceInclTax($basePrice);
+ $this->_subtotalInclTax += $subtotal;
+ $this->_baseSubtotalInclTax += $baseSubtotal;
+
+ if ($this->_config->getAlgorithm($store) == Mage_Tax_Model_Calculation::CALC_UNIT_BASE) {
+ $taxAmount = $this->_calculator->calcTaxAmount($price, $rate, true)*$qty;
+ $baseTaxAmount = $this->_calculator->calcTaxAmount($basePrice, $rate, true)*$qty;
+ $unitPrice = $this->_calculator->round(($subtotal-$taxAmount)/$qty);
+ $baseUnitPrice = $this->_calculator->round(($baseSubtotal-$baseTaxAmount)/$qty);
+ } else {
+ $taxAmount = $this->_calculator->calcTaxAmount($subtotal, $rate, true, false);
+ $baseTaxAmount = $this->_calculator->calcTaxAmount($subtotal, $rate, true, false);
+ $unitPrice = ($subtotal-$taxAmount)/$qty;
+ $baseUnitPrice = ($baseSubtotal-$baseTaxAmount)/$qty;
+ }
+ $subtotal = $this->_calculator->round(($subtotal-$taxAmount));
+ $baseSubtotal = $this->_calculator->round(($baseSubtotal-$baseTaxAmount));
+
+ $item->setOriginalPrice($unitPrice);
+ $item->setPrice($baseUnitPrice);
+ $item->setRowTotal($subtotal);
+ $item->setBaseRowTotal($baseSubtotal);
+
+ return $this;
+ }
+
+ /**
+ * Recalculate row information for item based on children calculation
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
+ */
+ protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
+ {
+ $price = 0;
+ $basePrice = 0;
+ $rowTotal = 0;
+ $baseRowTotal= 0;
+ $priceInclTax = 0;
+ $basePriceInclTax = 0;
+ $rowTotalInclTax = 0;
+ $baseRowTotalInclTax= 0;
+ foreach ($item->getChildren() as $child) {
+ $price += $child->getOriginalPrice();
+ $basePrice += $child->getBaseOriginalPrice();
+ $rowTotal += $child->getRowTotal();
+ $baseRowTotal+= $child->getBaseRowTotal();
+ $priceInclTax += $child->getPriceInclTax();
+ $basePriceInclTax += $child->getBasePriceInclTax();
+ $rowTotalInclTax += $child->getRowTotalInclTax();
+ $baseRowTotalInclTax+= $child->getBaseRowTotalInclTax();
+ }
+ $item->setOriginalPrice($price);
+ $item->setPrice($basePrice);
+ $item->setRowTotal($rowTotal);
+ $item->setBaseRowTotal($baseRowTotal);
+ $item->setPriceInclTax($priceInclTax);
+ $item->setBasePriceInclTax($basePriceInclTax);
+ $item->setRowTotalInclTax($rowTotalInclTax);
+ $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
+ return $this;
+ }
+
+ /**
+ * Add row total item amount to subtotal
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
+ */
+ protected function _addSubtotalAmount(Mage_Sales_Model_Quote_Address $address, $item)
+ {
+ $address->setTotalAmount('subtotal', $address->getTotalAmount('subtotal')+$item->getRowTotal());
+ $address->setBaseTotalAmount('subtotal', $address->getBaseTotalAmount('subtotal')+$item->getBaseRowTotal());
+ return $this;
+ }
+
+ /**
+ * Check if we need subtract store tax amount from item prices
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return bool
+ */
+ protected function _needSubtractTax($address)
+ {
+ $store = $address->getQuote()->getStore();
+ if ($this->_config->priceIncludesTax($store) || $this->_config->getNeedUsePriceExcludeTax()) {
+ return true;
+// return !$this->_calculator->compareRequests(
+// $this->_getStoreTaxRequest($address),
+// $this->_getAddressTaxRequest($address)
+// );
+ }
+ return false;
+ }
+
+ /**
+ * Check if we need subtract store tax amount from shipping
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return bool
+ */
+ protected function _needSubtractShippingTax($address)
+ {
+ $store = $address->getQuote()->getStore();
+ if ($this->_config->shippingPriceIncludesTax($store) || $this->_config->getNeedUseShippingExcludeTax()) {
+ return true;
+// return !$this->_calculator->compareRequests(
+// $this->_getStoreTaxRequest($address),
+// $this->_getAddressTaxRequest($address)
+// );
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php b/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php
new file mode 100644
index 0000000000..6ebe04f988
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php
@@ -0,0 +1,684 @@
+setCode('tax');
+ $this->_helper = Mage::helper('tax');
+ $this->_calculator = Mage::getSingleton('tax/calculation');
+ $this->_config = Mage::getSingleton('tax/config');
+ }
+
+ /**
+ * Collect tax totals for quote address
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ public function collect(Mage_Sales_Model_Quote_Address $address)
+ {
+ parent::collect($address);
+ $store = $address->getQuote()->getStore();
+ $address->setAppliedTaxes(array());
+
+ $items = $address->getAllItems();
+ if (!count($items)) {
+ return $this;
+ }
+ $request = $this->_calculator->getRateRequest(
+ $address,
+ $address->getQuote()->getBillingAddress(),
+ $address->getQuote()->getCustomerTaxClassId(),
+ $store
+ );
+
+ switch ($this->_config->getAlgorithm($store)) {
+ case Mage_Tax_Model_Calculation::CALC_UNIT_BASE:
+ $this->_unitBaseCalculation($address, $request);
+ break;
+ case Mage_Tax_Model_Calculation::CALC_ROW_BASE:
+ $this->_rowBaseCalculation($address, $request);
+ break;
+ case Mage_Tax_Model_Calculation::CALC_TOTAL_BASE:
+ $this->_totalBaseCalculation($address, $request);
+ break;
+ default:
+ break;
+ }
+
+ /**
+ * Subtract taxes from subtotal amount if prices include tax
+ */
+ if ($this->_config->priceIncludesTax($store)) {
+ $subtotal = $address->getTotalAmount('subtotal') - $address->getTotalAmount('tax');
+ $baseSubtotal = $address->getBaseTotalAmount('subtotal') - $address->getBaseTotalAmount('tax');
+ $address->setTotalAmount('subtotal', $subtotal);
+ $address->setBaseTotalAmount('subtotal', $baseSubtotal);
+ }
+
+
+ $this->_calculateShippingTax($address, $request);
+ return $this;
+ }
+
+ /**
+ * Tax caclulation for shipping price
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @param Varien_Object $taxRateRequest
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ protected function _calculateShippingTax(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
+ {
+ $store = $address->getQuote()->getStore();
+ $shippingTaxClass = $this->_config->getShippingTaxClass($store);
+ $shippingAmount = $address->getShippingAmount();
+ $baseShippingAmount = $address->getBaseShippingAmount();
+ $shippingDiscountAmount = $address->getShippingDiscountAmount();
+ $baseShippingDiscountAmount = $address->getBaseShippingDiscountAmount();
+
+ /**
+ * Subtract discount before calculate tax amount
+ */
+ if ($this->_config->applyTaxAfterDiscount($store)) {
+ $calcAmount = $shippingAmount - $shippingDiscountAmount;
+ $baseCalcAmount = $baseShippingAmount - $baseShippingDiscountAmount;
+ } else {
+ $calcAmount = $shippingAmount;
+ $baseCalcAmount = $baseShippingAmount;
+ }
+
+ $shippingTax = 0;
+ $shippingBaseTax = 0;
+
+ if ($shippingTaxClass) {
+ $taxRateRequest->setProductClassId($shippingTaxClass);
+ $rate = $this->_calculator->getRate($taxRateRequest);
+ if ($rate) {
+ if ($this->_config->shippingPriceIncludesTax() && !$this->_config->getNeedUseShippingExcludeTax()) {
+ $shippingTax = $this->_calculator->calcTaxAmount($calcAmount, $rate, true);
+ $shippingBaseTax= $this->_calculator->calcTaxAmount($baseCalcAmount, $rate, true);
+ $shippingAmount-= $shippingTax;
+ $baseShippingAmount-=$shippingBaseTax;
+ } else {
+ $shippingTax = $this->_calculator->calcTaxAmount($calcAmount, $rate);
+ $shippingBaseTax= $this->_calculator->calcTaxAmount($baseCalcAmount, $rate);
+ }
+
+ $address->setTotalAmount('shipping', $shippingAmount);
+ $address->setBaseTotalAmount('shipping', $baseShippingAmount);
+
+ /**
+ * Provide additional attributes for apply discount on price include tax
+ */
+ if ($this->_config->discountTax($store)) {
+ $address->setShippingAmountForDiscount($shippingAmount+$shippingTax);
+ $address->setBaseShippingAmountForDiscount($baseShippingAmount+$shippingBaseTax);
+ }
+
+ $this->_addAmount($shippingTax);
+ $this->_addBaseAmount($shippingBaseTax);
+
+ $applied = $this->_calculator->getAppliedRates($taxRateRequest);
+ $this->_saveAppliedTaxes($address, $applied, $shippingTax, $shippingBaseTax, $rate);
+ }
+ }
+ $address->setShippingTaxAmount($shippingTax);
+ $address->setBaseShippingTaxAmount($shippingBaseTax);
+
+ return $this;
+ }
+
+ /**
+ * Calculate address tax amount based on one unit price and tax amount
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ protected function _unitBaseCalculation(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
+ {
+ $items = $address->getAllItems();
+ foreach ($items as $item) {
+ /**
+ * Child item's tax we calculate for parent - that why we skip them
+ */
+ if ($item->getParentItemId()) {
+ continue;
+ }
+
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
+ foreach ($item->getChildren() as $child) {
+ $taxRateRequest->setProductClassId($child->getProduct()->getTaxClassId());
+ $rate = $this->_calculator->getRate($taxRateRequest);
+ $this->_calcUnitTaxAmount($child, $rate);
+
+ $this->_addAmount($child->getTaxAmount());
+ $this->_addBaseAmount($child->getBaseTaxAmount());
+
+ $applied = $this->_calculator->getAppliedRates($taxRateRequest);
+ $this->_saveAppliedTaxes($address, $applied, $child->getTaxAmount(), $child->getBaseTaxAmount(), $rate);
+ }
+ $this->_recalculateParent($item);
+ }
+ else {
+ $taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId());
+ $rate = $this->_calculator->getRate($taxRateRequest);
+
+ $this->_calcUnitTaxAmount($item, $rate);
+
+ $this->_addAmount($item->getTaxAmount());
+ $this->_addBaseAmount($item->getBaseTaxAmount());
+
+ $applied = $this->_calculator->getAppliedRates($taxRateRequest);
+ $this->_saveAppliedTaxes($address, $applied, $item->getTaxAmount(), $item->getBaseTaxAmount(), $rate);
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Calculate unit tax anount based on unit price
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @param float $rate
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ protected function _calcUnitTaxAmount(Mage_Sales_Model_Quote_Item_Abstract $item, $rate)
+ {
+ $store = $item->getStore();
+ $price = $store->roundPrice($item->getCalculationPrice());
+ $basePrice = $store->roundPrice($item->getBaseCalculationPrice());
+ $origPrice = $store->roundPrice($item->getOriginalPrice());
+ $baseOrigPrice = $store->roundPrice($item->getBaseOriginalPrice());
+ $discountAmount = $item->getDiscountAmount();
+ $baseDiscountAmount = $item->getBaseDiscountAmount();
+ $qty = $item->getTotalQty();
+
+ $item->setTaxPercent($rate);
+ $rate = $rate/100;
+
+ $calculationSequence = $this->_config->getCalculationSequence($store);
+ switch ($calculationSequence) {
+ case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
+ $unitTax = $this->_calculator->calcTaxAmount($price, $rate);
+ $baseUnitTax = $this->_calculator->calcTaxAmount($basePrice, $rate);
+ $unitOrigTax = $this->_calculator->calcTaxAmount($origPrice, $rate);
+ $baseUnitOrigTax = $this->_calculator->calcTaxAmount($baseOrigPrice, $rate);
+ $priceInclTax = $price+$unitTax;
+ $basePriceInclTax = $basePrice+$baseUnitTax;
+ $priceExclTax = $price;
+ $basePriceExclTax = $basePrice;
+ break;
+ case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
+ $unitTax = $this->_calculator->calcTaxAmount($price, $rate);
+ $baseUnitTax = $this->_calculator->calcTaxAmount($basePrice, $rate);
+ $unitOrigTax = $this->_calculator->calcTaxAmount($origPrice, $rate);
+ $baseUnitOrigTax = $this->_calculator->calcTaxAmount($baseOrigPrice, $rate);
+ $priceInclTax = $price+$unitTax;
+ $basePriceInclTax = $basePrice+$baseUnitTax;
+ $priceExclTax = $price;
+ $basePriceExclTax = $basePrice;
+ $item->setDiscountCalculationPrice($priceInclTax);
+ $item->setBaseDiscountCalculationPrice($basePriceInclTax);
+ break;
+ case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
+ case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
+ $unitTax = $this->_calculator->calcTaxAmount($price-$discountAmount/$qty, $rate);
+ $baseUnitTax = $this->_calculator->calcTaxAmount($basePrice-$baseDiscountAmount/$qty, $rate);
+ $unitOrigTax = $this->_calculator->calcTaxAmount($origPrice-$discountAmount/$qty, $rate);
+ $baseUnitOrigTax = $this->_calculator->calcTaxAmount($baseOrigPrice-$baseDiscountAmount/$qty, $rate);
+ $priceInclTax = $price+$unitTax;
+ $basePriceInclTax = $basePrice+$baseUnitTax;
+ $priceExclTax = $price;
+ $basePriceExclTax = $basePrice;
+ break;
+ }
+
+ /**
+ * Check if allowed apply tax to custom price
+ */
+ if ($item->hasCustomPrice() && $this->_helper->applyTaxOnCustomPrice($store)) {
+ $totalTax = $store->roundPrice($qty*$unitTax);
+ $totalBaseTax = $store->roundPrice($qty*$baseUnitTax);
+ } else {
+ $totalTax = $store->roundPrice($qty*$unitOrigTax);
+ $totalBaseTax = $store->roundPrice($qty*$baseUnitOrigTax);
+ }
+
+ $item->setTaxAmount($totalTax);
+ $item->setBaseTaxAmount($totalBaseTax);
+ return $this;
+ }
+
+ /**
+ * Calculate address total tax based on row total
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @param Varien_Object $taxRateRequest
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ protected function _rowBaseCalculation(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
+ {
+ $items = $address->getAllItems();
+ foreach ($items as $item) {
+ /**
+ * Child item's tax we calculate for parent - that why we skip them
+ */
+ if ($item->getParentItemId()) {
+ continue;
+ }
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
+ foreach ($item->getChildren() as $child) {
+ $rate = $this->_calculator->getRate(
+ $taxRateRequest->setProductClassId($child->getProduct()->getTaxClassId())
+ );
+ $this->_calcRowTaxAmount($child, $rate);
+ $this->_addAmount($child->getTaxAmount());
+ $this->_addBaseAmount($child->getBaseTaxAmount());
+
+ $applied = $this->_calculator->getAppliedRates($taxRateRequest);
+ $this->_saveAppliedTaxes($address, $applied, $child->getTaxAmount(), $child->getBaseTaxAmount(), $rate);
+ }
+ $this->_recalculateParent($item);
+ }
+ else {
+ $rate = $this->_calculator->getRate(
+ $taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId())
+ );
+ $this->_calcRowTaxAmount($item, $rate);
+ $this->_addAmount($item->getTaxAmount());
+ $this->_addBaseAmount($item->getBaseTaxAmount());
+
+ $applied = $this->_calculator->getAppliedRates($taxRateRequest);
+ $this->_saveAppliedTaxes($address, $applied, $item->getTaxAmount(), $item->getBaseTaxAmount(), $rate);
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Calculate item tax amount based on row total
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @param float $rate
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ protected function _calcRowTaxAmount($item, $rate)
+ {
+ $store = $item->getStore();
+ $qty = $item->getTotalQty();
+ if ($item->hasCustomPrice() && $this->_helper->applyTaxOnCustomPrice($store)) {
+ $subtotal = $item->getRowTotal();
+ $baseSubtotal = $item->getBaseRowTotal();
+ } else {
+ $subtotal = $item->getTotalQty()*$item->getOriginalPrice();
+ $baseSubtotal = $item->getTotalQty()*$item->getBaseOriginalPrice();
+ }
+ $discountAmount = $item->getDiscountAmount();
+ $baseDiscountAmount = $item->getBaseDiscountAmount();
+
+ $item->setTaxPercent($rate);
+ $rate = $rate/100;
+
+ $calculationSequence = $this->_helper->getCalculationSequence($store);
+ switch ($calculationSequence) {
+ case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
+ $rowTax = $this->_calculator->calcTaxAmount($subtotal, $rate, false, false);
+ $baseRowTax = $this->_calculator->calcTaxAmount($baseSubtotal, $rate, false, false);
+ $calcTotal = $subtotal;
+ $baseCalcTotal = $baseSubtotal;
+ break;
+ case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
+ $rowTax = $this->_calculator->calcTaxAmount($subtotal, $rate, false, false);
+ $baseRowTax = $this->_calculator->calcTaxAmount($baseSubtotal, $rate, false, false);
+ $calcTotal = $subtotal;
+ $baseCalcTotal = $baseSubtotal;
+ $item->setDiscountCalculationPrice(($subtotal+$rowTax)/$qty);
+ $item->setBaseDiscountCalculationPrice(($baseSubtotal+$baseRowTax)/$qty);
+ break;
+ case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
+ case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
+ $rowTax = $this->_calculator->calcTaxAmount($subtotal-$discountAmount, $rate, false, false);
+ $baseRowTax = $this->_calculator->calcTaxAmount($baseSubtotal-$baseDiscountAmount, $rate, false, false);
+ $calcTotal = $subtotal-$discountAmount;
+ $baseCalcTotal = $baseSubtotal-$baseDiscountAmount;
+ break;
+ }
+
+ $item->setTaxAmount($rowTax);
+ $item->setBaseTaxAmount($baseRowTax);
+ return $this;
+ }
+
+ /**
+ * Calculate address total tax based on address subtotal
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @param Varien_Object $taxRateRequest
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ protected function _totalBaseCalculation(Mage_Sales_Model_Quote_Address $address, $taxRateRequest)
+ {
+ $items = $address->getAllItems();
+ $store = $address->getQuote()->getStore();
+ $taxGroups = array();
+
+ foreach ($items as $item) {
+ /**
+ * Child item's tax we calculate for parent - that why we skip them
+ */
+ if ($item->getParentItemId()) {
+ continue;
+ }
+
+ if ($item->getHasChildren() && $item->isChildrenCalculated()) {
+ foreach ($item->getChildren() as $child) {
+ $rate = $this->_calculator->getRate(
+ $taxRateRequest->setProductClassId($child->getProduct()->getTaxClassId())
+ );
+ $taxGroups[(string)$rate]['applied_rates'] = $this->_calculator->getAppliedRates($taxRateRequest);
+ $this->_aggregateTaxPerRate($child, $rate, $taxGroups);
+ }
+ $this->_recalculateParent($item);
+ } else {
+ $rate = $this->_calculator->getRate(
+ $taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId())
+ );
+ $taxGroups[(string)$rate]['applied_rates'] = $this->_calculator->getAppliedRates($taxRateRequest);
+ $this->_aggregateTaxPerRate($item, $rate, $taxGroups);
+ }
+ }
+
+ foreach ($taxGroups as $rateKey => $data) {
+ $rate = (float) $rateKey;
+ $totalTax = $this->_calculator->calcTaxAmount(array_sum($data['totals']), $rate,
+ $this->_helper->priceIncludesTax($store)
+ );
+ $baseTotalTax = $this->_calculator->calcTaxAmount(array_sum($data['base_totals']), $rate,
+ $this->_helper->priceIncludesTax($store)
+ );
+ $this->_addAmount($totalTax);
+ $this->_addBaseAmount($baseTotalTax);
+ $this->_saveAppliedTaxes($address, $data['applied_rates'], $totalTax, $baseTotalTax, $rate);
+ }
+ return $this;
+ }
+
+ /**
+ * Aggregate row totals per tax rate in array
+ *
+ * @param Mage_Sales_Model_Quote_Item_Abstract $item
+ * @param float $rate
+ * @param array $taxGroups
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ protected function _aggregateTaxPerRate($item, $rate, &$taxGroups)
+ {
+ $store = $item->getStore();
+ if ($item->hasCustomPrice() && $this->_helper->applyTaxOnCustomPrice($store)) {
+ $subtotal = $item->getRowTotal();
+ $baseSubtotal = $item->getBaseRowTotal();
+ } else {
+ $subtotal = $item->getTotalQty()*$item->getOriginalPrice();
+ $baseSubtotal = $item->getTotalQty()*$item->getBaseOriginalPrice();
+ }
+ $discountAmount = $item->getDiscountAmount();
+ $baseDiscountAmount = $item->getBaseDiscountAmount();
+ $qty = $item->getTotalQty();
+ $rateKey = (string) $rate;
+ $calcTotal = 0;
+ $baseCalcTotal = 0;
+
+ $item->setTaxPercent($rate);
+ if (!isset($taxGroups[$rateKey]['totals'])) {
+ $taxGroups[$rateKey]['totals'] = array();
+ }
+ if (!isset($taxGroups[$rateKey]['totals'])) {
+ $taxGroups[$rateKey]['base_totals'] = array();
+ }
+
+ $calculationSequence = $this->_helper->getCalculationSequence($store);
+ switch ($calculationSequence) {
+ case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
+ $rowTax = $this->_calculator->calcTaxAmount($subtotal, $rate, false, false);
+ $baseRowTax = $this->_calculator->calcTaxAmount($baseSubtotal, $rate, false, false);
+ $calcTotal = $subtotal;
+ $baseCalcTotal = $baseSubtotal;
+ break;
+ case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
+ $rowTax = $this->_calculator->calcTaxAmount($subtotal, $rate, false, false);
+ $baseRowTax = $this->_calculator->calcTaxAmount($baseSubtotal, $rate, false, false);
+ $calcTotal = $subtotal;
+ $baseCalcTotal = $baseSubtotal;
+ $item->setDiscountCalculationPrice(($subtotal+$rowTax)/$qty);
+ $item->setBaseDiscountCalculationPrice(($baseSubtotal+$baseRowTax)/$qty);
+ break;
+ case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
+ case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
+ $rowTax = $this->_calculator->calcTaxAmount($subtotal-$discountAmount, $rate, false, false);
+ $baseRowTax = $this->_calculator->calcTaxAmount($baseSubtotal-$baseDiscountAmount, $rate, false, false);
+ $calcTotal = $subtotal-$discountAmount;
+ $baseCalcTotal = $baseSubtotal-$baseDiscountAmount;
+ break;
+ }
+
+ /**
+ * "Delta" rounding
+ */
+ $delta = isset($this->_roundingDeltas[$rateKey]) ? $this->_roundingDeltas[$rateKey] : 0;
+ $baseDelta = isset($this->_baseRoundingDeltas[$rateKey]) ? $this->_baseRoundingDeltas[$rateKey] : 0;
+
+ $rowTax += $delta;
+ $baseRowTax += $baseDelta;
+
+ $this->_roundingDeltas[$rateKey] = $rowTax - $this->_calculator->round($rowTax);
+ $this->_baseRoundingDeltas[$rateKey] = $baseRowTax - $this->_calculator->round($baseRowTax);
+ $rowTax = $this->_calculator->round($rowTax);
+ $baseRowTax = $this->_calculator->round($baseRowTax);
+ $item->setTaxAmount($rowTax);
+ $item->setBaseTaxAmount($baseRowTax);
+
+ $taxGroups[$rateKey]['totals'][] = $calcTotal;
+ $taxGroups[$rateKey]['base_totals'][] = $baseCalcTotal;
+ return $this;
+ }
+
+ protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
+ {
+ $calculationPrice = 0;
+ $baseCalculationPrice = 0;
+ $rowTaxAmount = 0;
+ $baseRowTaxAmount = 0;
+ $rowTotal = 0;
+ $baseRowTotal = 0;
+ foreach ($item->getChildren() as $child) {
+ $calculationPrice += $child->getCalculationPrice();
+ $baseCalculationPrice += $child->getBaseCalculationPrice();
+ $rowTaxAmount += $child->getTaxAmount();
+ $baseRowTaxAmount += $child->getBaseTaxAmount();
+ $rowTotal += $child->getRowTotal();
+ $baseRowTotal += $child->getBaseRowTotal();
+ }
+ $item->setOriginalPrice($calculationPrice);
+ $item->setPrice($baseCalculationPrice);
+ $item->setTaxAmount($rowTaxAmount);
+ $item->setBaseTaxAmount($baseRowTaxAmount);
+ $item->setRowTotal($rowTotal);
+ $item->setBaseRowTotal($baseRowTotal);
+ return $this;
+ }
+
+ /**
+ * Collect applied tax rates information on address level
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @param array $applied
+ * @param float $amount
+ * @param float $baseAmount
+ * @param float $rate
+ */
+ protected function _saveAppliedTaxes(Mage_Sales_Model_Quote_Address $address, $applied, $amount, $baseAmount, $rate)
+ {
+ $previouslyAppliedTaxes = $address->getAppliedTaxes();
+ $process = count($previouslyAppliedTaxes);
+
+ foreach ($applied as $row) {
+ if (!isset($previouslyAppliedTaxes[$row['id']])) {
+ $row['process'] = $process;
+ $row['amount'] = 0;
+ $row['base_amount'] = 0;
+ $previouslyAppliedTaxes[$row['id']] = $row;
+ }
+
+ if (!is_null($row['percent'])) {
+ $row['percent'] = $row['percent'] ? $row['percent'] : 1;
+ $rate = $rate ? $rate : 1;
+
+ $appliedAmount = $amount/$rate*$row['percent'];
+ $baseAppliedAmount = $baseAmount/$rate*$row['percent'];
+ } else {
+ $appliedAmount = 0;
+ $baseAppliedAmount = 0;
+ foreach ($row['rates'] as $rate) {
+ $appliedAmount += $rate['amount'];
+ $baseAppliedAmount += $rate['base_amount'];
+ }
+ }
+
+
+ if ($appliedAmount || $previouslyAppliedTaxes[$row['id']]['amount']) {
+ $previouslyAppliedTaxes[$row['id']]['amount'] += $appliedAmount;
+ $previouslyAppliedTaxes[$row['id']]['base_amount'] += $baseAppliedAmount;
+ } else {
+ unset($previouslyAppliedTaxes[$row['id']]);
+ }
+ }
+ $address->setAppliedTaxes($previouslyAppliedTaxes);
+ }
+
+ /**
+ * Add tax totals information to address object
+ *
+ * @param Mage_Sales_Model_Quote_Address $address
+ * @return Mage_Tax_Model_Sales_Total_Quote
+ */
+ public function fetch(Mage_Sales_Model_Quote_Address $address)
+ {
+ $applied= $address->getAppliedTaxes();
+ $store = $address->getQuote()->getStore();
+ $amount = $address->getTaxAmount();
+ $area = null;
+ if ($this->_config->displayCartTaxWithGrandTotal($store) && $address->getGrandTotal()) {
+ $area = 'taxes';
+ }
+
+ if (($amount!=0) || ($this->_config->displayCartZeroTax($store))) {
+ $address->addTotal(array(
+ 'code' => $this->getCode(),
+ 'title' => Mage::helper('tax')->__('Tax'),
+ 'full_info' => $applied ? $applied : array(),
+ 'value' => $amount,
+ 'area' => $area
+ ));
+ }
+
+ $store = $address->getQuote()->getStore();
+ /**
+ * Modify subtotal
+ */
+ if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
+ if ($address->getSubtotalInclTax()) {
+ $subtotalInclTax = $address->getSubtotalInclTax();
+ } else {
+ $subtotalInclTax = $address->getSubtotal()+$address->getTaxAmount()-$address->getShippingTaxAmount();
+ }
+
+ $address->addTotal(array(
+ 'code' => 'subtotal',
+ 'title' => Mage::helper('sales')->__('Subtotal'),
+ 'value' => $subtotalInclTax,
+ 'value_incl_tax' => $subtotalInclTax,
+ 'value_excl_tax' => $address->getSubtotal(),
+ ));
+ }
+
+ return $this;
+ }
+
+ /**
+ * Process model configuration array.
+ * This method can be used for changing totals collect sort order
+ *
+ * @param array $config
+ * @param store $store
+ * @return array
+ */
+ public function processConfigArray($config, $store)
+ {
+ $calculationSequence = $this->_helper->getCalculationSequence($store);
+ switch ($calculationSequence) {
+ case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
+ $config['before'][] = 'discount';
+ break;
+ default:
+ $config['after'][] = 'discount';
+ break;
+ }
+ return $config;
+ }
+}
\ No newline at end of file
diff --git a/app/code/core/Mage/Tax/Model/System/Config/Source/Algorithm.php b/app/code/core/Mage/Tax/Model/System/Config/Source/Algorithm.php
new file mode 100644
index 0000000000..93d3abe0d0
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/System/Config/Source/Algorithm.php
@@ -0,0 +1,53 @@
+_options = array(
+ array(
+ 'value' => Mage_Tax_Model_Calculation::CALC_UNIT_BASE,
+ 'label' => Mage::helper('tax')->__('Unit Price')
+ ),
+ array(
+ 'value' => Mage_Tax_Model_Calculation::CALC_ROW_BASE,
+ 'label' => Mage::helper('tax')->__('Row Total')
+ ),
+ array(
+ 'value' => Mage_Tax_Model_Calculation::CALC_TOTAL_BASE,
+ 'label' => Mage::helper('tax')->__('Total')
+ ),
+ );
+ }
+
+ public function toOptionArray()
+ {
+ return $this->_options;
+ }
+}
diff --git a/app/code/core/Mage/Tax/Model/System/Config/Source/Apply.php b/app/code/core/Mage/Tax/Model/System/Config/Source/Apply.php
new file mode 100644
index 0000000000..954e98cc50
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/System/Config/Source/Apply.php
@@ -0,0 +1,49 @@
+_options = array(
+ array(
+ 'value' => 0,
+ 'label' => Mage::helper('tax')->__('Before Discount')
+ ),
+ array(
+ 'value' => 1,
+ 'label' => Mage::helper('tax')->__('After Discount')
+ ),
+ );
+ }
+
+ public function toOptionArray()
+ {
+ return $this->_options;
+ }
+}
diff --git a/app/code/core/Mage/Tax/Model/System/Config/Source/PriceType.php b/app/code/core/Mage/Tax/Model/System/Config/Source/PriceType.php
new file mode 100644
index 0000000000..7b35b76fdc
--- /dev/null
+++ b/app/code/core/Mage/Tax/Model/System/Config/Source/PriceType.php
@@ -0,0 +1,49 @@
+_options = array(
+ array(
+ 'value' => 0,
+ 'label' => Mage::helper('tax')->__('Excluding Tax')
+ ),
+ array(
+ 'value' => 1,
+ 'label' => Mage::helper('tax')->__('Including Tax')
+ ),
+ );
+ }
+
+ public function toOptionArray()
+ {
+ return $this->_options;
+ }
+}
diff --git a/app/code/core/Mage/Tax/etc/config.xml b/app/code/core/Mage/Tax/etc/config.xml
index 33dcc6ff90..4c7d4106b1 100644
--- a/app/code/core/Mage/Tax/etc/config.xml
+++ b/app/code/core/Mage/Tax/etc/config.xml
@@ -28,7 +28,7 @@
- 0.7.8
+ 0.7.9
@@ -79,6 +79,22 @@
+
+
+ *
+ *
+
+
+ *
+ *
+ *
+ *
+
+
+ * * *
+ * * *
+
+
@@ -117,6 +133,60 @@
+
+
+
+
+ tax/sales_total_quote_subtotal
+ shipping
+ tax,discount
+
+
+ tax/sales_total_quote_tax
+ subtotal,shipping
+ grand_total
+ tax/checkout_tax
+ adminhtml/sales_order_create_totals_tax
+
+
+
+ tax/checkout_subtotal
+ adminhtml/sales_order_create_totals_subtotal
+
+
+ tax/checkout_shipping
+ adminhtml/sales_order_create_totals_shipping
+
+
+ tax/checkout_discount
+ adminhtml/sales_order_create_totals_discount
+
+
+ tax/checkout_grandtotal
+ adminhtml/sales_order_create_totals_grandtotal
+
+
+
+
+
+
+ tax/sales_pdf_subtotal
+ tax/sales_pdf_shipping
+ tax/sales_pdf_grandtotal
+
+ Tax
+ tax_amount
+ tax/sales_pdf_tax
+ 7
+ 0
+ 300
+
+
+
@@ -229,6 +299,7 @@
+ TOTAL_BASE_CALCULATION
0
0
shipping
@@ -243,11 +314,27 @@
*
- 1
1
- 0
1
+
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+
+
+ 1
+ 1
+ 1
+ 1
+ 0
+ 0
+ 0
+
diff --git a/app/code/core/Mage/Tax/etc/system.xml b/app/code/core/Mage/Tax/etc/system.xml
index 49a19dfde4..6f95c9c35d 100644
--- a/app/code/core/Mage/Tax/etc/system.xml
+++ b/app/code/core/Mage/Tax/etc/system.xml
@@ -55,14 +55,23 @@
- Calculation
+ Calculation Settings
20
1
1
1
+
+ Tax Calculation Method Based On
+ select
+ tax/system_config_source_algorithm
+ 1
+ 1
+ 1
+ 0
+
- Tax Based On
+ Tax Calculation Based On
select
adminhtml/system_config_source_tax_basedon
10
@@ -71,43 +80,43 @@
0
- Catalog prices include tax
+ Catalog prices
select
tax/config_price_include
- adminhtml/system_config_source_yesno
+ tax/system_config_source_priceType
20
1
1
0
- Shipping prices include tax
+ Shipping prices
select
tax/config_price_include
- adminhtml/system_config_source_yesno
+ tax/system_config_source_priceType
30
1
1
0
- Apply Tax After Discount
+ Apply Customer Tax
select
- adminhtml/system_config_source_yesno
+ tax/system_config_source_apply
40
1
1
0
- Apply Discount On Prices Including Tax
+ Apply Discount On Prices
select
- adminhtml/system_config_source_yesno
+ tax/system_config_source_priceType
50
1
1
0
- Ignored when 'Apply Tax After Discount' option is enabled
+ Apply Discount on Price Including Tax is calculated based on store tax, if 'Apply Tax after Discount' is selected.
Apply Tax On
@@ -157,48 +166,165 @@
- Display
+ Price Display Settings
40
1
1
1
-
- Display Cart/Order Prices
+
+ Display Product Prices In Catalog
select
tax/system_config_source_tax_display_type
10
1
1
1
-
+
+
+ Display Shipping Prices
+ select
+ tax/system_config_source_tax_display_type
+ 20
+ 1
+ 1
+ 1
+
+
+
+
+ Shopping Cart Display Settings
+ 50
+ 1
+ 1
+ 1
+
+
+ Display Prices
+ select
+ tax/system_config_source_tax_display_type
+ 10
+ 1
+ 1
+ 1
+
+
+ Display Subtotal
+ select
+ tax/system_config_source_tax_display_type
+ 20
+ 1
+ 1
+ 1
+
+
+ Display Shipping Amount
+ select
+ tax/system_config_source_tax_display_type
+ 30
+ 1
+ 1
+ 1
+
+
+
+ Include Tax In Grand Total
+ select
+ adminhtml/system_config_source_yesno
+ 50
+ 1
+ 1
+ 1
+
Display full tax summary
select
adminhtml/system_config_source_yesno
- 20
+ 60
1
1
1
-
- Display Product Prices
+
+ Display Zero Tax Subtotal
+ select
+ adminhtml/system_config_source_yesno
+ 120
+ 1
+ 1
+ 1
+
+
+
+
+ Orders, Invoices, Creditmemos Display Settings
+ 60
+ 1
+ 1
+ 1
+
+
+ Display Prices
select
tax/system_config_source_tax_display_type
- 100
+ 10
1
1
1
-
+
+
+ Display Subtotal
+ select
+ tax/system_config_source_tax_display_type
+ 20
+ 1
+ 1
+ 1
+
- Display Shipping Prices
+ Display Shipping Amount
select
tax/system_config_source_tax_display_type
- 100
+ 30
1
1
1
+
+
+ Include Tax In Grand Total
+ select
+ adminhtml/system_config_source_yesno
+ 50
+ 1
+ 1
+ 1
+
+
+ Display full tax summary
+ select
+ adminhtml/system_config_source_yesno
+ 60
+ 1
+ 1
+ 1
+
Display Zero Tax Subtotal
select
@@ -209,7 +335,7 @@
1
-
+
diff --git a/app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.8-0.7.9.php b/app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.8-0.7.9.php
new file mode 100644
index 0000000000..215fa3cc4c
--- /dev/null
+++ b/app/code/core/Mage/Tax/sql/tax_setup/mysql4-upgrade-0.7.8-0.7.9.php
@@ -0,0 +1,67 @@
+addAttribute('invoice', 'shipping_tax_amount', array('type'=>'decimal'));
+$installer->addAttribute('invoice', 'base_shipping_tax_amount', array('type'=>'decimal'));
+
+$installer->addAttribute('creditmemo', 'shipping_tax_amount', array('type'=>'decimal'));
+$installer->addAttribute('creditmemo', 'base_shipping_tax_amount', array('type'=>'decimal'));
+
+$installer->addAttribute('quote_item', 'price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_item', 'base_price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_item', 'row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_item', 'base_row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_address_item', 'price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_address_item', 'base_price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_address_item', 'row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_address_item', 'base_row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_address', 'subtotal_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('quote_address', 'base_subtotal_total_incl_tax', array('type'=>'decimal'));
+
+$installer->addAttribute('order_item', 'price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('order_item', 'base_price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('order_item', 'row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('order_item', 'base_row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('order', 'subtotal_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('order', 'base_subtotal_incl_tax', array('type'=>'decimal'));
+
+$installer->addAttribute('invoice_item', 'price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('invoice_item', 'base_price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('invoice_item', 'row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('invoice_item', 'base_row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('invoice', 'subtotal_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('invoice', 'base_subtotal_incl_tax', array('type'=>'decimal'));
+
+$installer->addAttribute('creditmemo_item', 'price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('creditmemo_item', 'base_price_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('creditmemo_item', 'row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('creditmemo_item', 'base_row_total_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('creditmemo', 'subtotal_incl_tax', array('type'=>'decimal'));
+$installer->addAttribute('creditmemo', 'base_subtotal_incl_tax', array('type'=>'decimal'));
+
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
index 9bfd44b18b..d854d5aec9 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php
@@ -426,30 +426,34 @@ protected function _parseXmlResponse($response)
{
$costArr = array();
$priceArr = array();
- $errorTitle = 'Unable to retrieve quotes';
+
if (strlen(trim($response))>0) {
- if (strpos(trim($response), 'Error) && is_object($xml->Error->Message)) {
- $errorTitle = (string)$xml->Error->Message;
- } elseif (is_object($xml->SoftError) && is_object($xml->SoftError->Message)) {
- $errorTitle = (string)$xml->SoftError->Message;
- } else {
- $errorTitle = 'Unknown error';
- }
- $allowedMethods = explode(",", $this->getConfigData('allowed_methods'));
- foreach ($xml->Entry as $entry) {
- if (in_array((string)$entry->Service, $allowedMethods)) {
- $costArr[(string)$entry->Service] = (string)$entry->EstimatedCharges->DiscountedCharges->NetCharge;
- $priceArr[(string)$entry->Service] = $this->getMethodPrice((string)$entry->EstimatedCharges->DiscountedCharges->NetCharge, (string)$entry->Service);
- }
- }
- asort($priceArr);
- }
- } else {
- $errorTitle = 'Response is in the wrong format';
- }
+ if ($xml = $this->_parseXml($response)) {
+
+ if (is_object($xml->Error) && is_object($xml->Error->Message)) {
+ $errorTitle = (string)$xml->Error->Message;
+ } elseif (is_object($xml->SoftError) && is_object($xml->SoftError->Message)) {
+ $errorTitle = (string)$xml->SoftError->Message;
+ } else {
+ $errorTitle = 'Unknown error';
+ }
+
+ $allowedMethods = explode(",", $this->getConfigData('allowed_methods'));
+
+ foreach ($xml->Entry as $entry) {
+ if (in_array((string)$entry->Service, $allowedMethods)) {
+ $costArr[(string)$entry->Service] = (string)$entry->EstimatedCharges->DiscountedCharges->NetCharge;
+ $priceArr[(string)$entry->Service] = $this->getMethodPrice((string)$entry->EstimatedCharges->DiscountedCharges->NetCharge, (string)$entry->Service);
+ }
+ }
+
+ asort($priceArr);
+
+ } else {
+ $errorTitle = 'Response is in the wrong format.';
+ }
+ } else {
+ $errorTitle = 'Unable to retrieve tracking';
}
$result = Mage::getModel('shipping/rate_result');
@@ -476,6 +480,21 @@ protected function _parseXmlResponse($response)
return $result;
}
+ public function _parseXml($xmlContent)
+ {
+ try {
+ try {
+ $xml = simplexml_load_string($xmlContent);
+ return $xml;
+ } catch (Exception $e) {
+ throw new Exception('Invalid XML document "' . $xmlContent . '"');
+ }
+ } catch (Exception $e) {
+ Mage::logException($e);
+ return false;
+ }
+ }
+
/*
public function isEligibleForFree($method)
{
@@ -646,19 +665,15 @@ protected function _parseXmlTrackingResponse($trackingvalue,$response)
{
$resultArr=array();
if (strlen(trim($response))>0) {
- if (strpos(trim($response), 'Error) && is_object($xml->Error->Message)) {
- $errorTitle = (string)$xml->Error->Message;
- } elseif (is_object($xml->SoftError) && is_object($xml->SoftError->Message)) {
- $errorTitle = (string)$xml->SoftError->Message;
- }
- }else{
- $errorTitle = 'Error in loading response';
- }
-
- if (!isset($errorTitle)) {
+ if ($xml = $this->_parseXml($response)) {
+
+ if (is_object($xml->Error) && is_object($xml->Error->Message)) {
+ $errorTitle = (string)$xml->Error->Message;
+ } elseif (is_object($xml->SoftError) && is_object($xml->SoftError->Message)) {
+ $errorTitle = (string)$xml->SoftError->Message;
+ }
+
+ if (!isset($errorTitle)) {
$resultArr['status'] = (string)$xml->Package->StatusDescription;
$resultArr['service'] = (string)$xml->Package->Service;
$resultArr['deliverydate'] = (string)$xml->Package->DeliveredDate;
diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php
index e0293ec3b1..9507eb51e5 100644
--- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php
+++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php
@@ -149,6 +149,7 @@ public function setRequest(Mage_Shipping_Model_Rate_Request $request)
}
$weight = $this->getTotalNumOfBoxes($request->getPackageWeight());
+ $weight = ceil($weight*10) / 10;
$r->setWeight($weight);
if ($request->getFreeMethodWeight()!=$request->getPackageWeight()) {
$r->setFreeMethodWeight($request->getFreeMethodWeight());
@@ -191,6 +192,7 @@ protected function _setFreeMethodRequest($freeMethod)
$r = $this->_rawRequest;
$weight = $this->getTotalNumOfBoxes($r->getFreeMethodWeight());
+ $weight = ceil($weight*10) / 10;
$r->setWeight($weight);
$r->setAction($this->getCode('action', 'single'));
$r->setProduct($freeMethod);
diff --git a/app/code/core/Mage/Wishlist/Block/Abstract.php b/app/code/core/Mage/Wishlist/Block/Abstract.php
new file mode 100644
index 0000000000..ef26ef407b
--- /dev/null
+++ b/app/code/core/Mage/Wishlist/Block/Abstract.php
@@ -0,0 +1,245 @@
+
+ */
+abstract class Mage_Wishlist_Block_Abstract extends Mage_Catalog_Block_Product_Abstract
+{
+ /**
+ * Wishlist Product Items Collection
+ *
+ * @var Mage_Wishlist_Model_Mysql4_Product_Collection
+ */
+ protected $_collection;
+
+ /**
+ * Wishlist Model
+ *
+ * @var Mage_Wishlist_Model_Wishlist
+ */
+ protected $_wishlist;
+
+ /**
+ * Retrieve Wishlist Data Helper
+ *
+ * @return Mage_Wishlist_Helper_Data
+ */
+ protected function _getHelper()
+ {
+ return Mage::helper('wishlist');
+ }
+
+ /**
+ * Retrieve Customer Session instance
+ *
+ * @return Mage_Customer_Model_Session
+ */
+ protected function _getCustomerSession()
+ {
+ return Mage::getSingleton('customer/session');
+ }
+
+ /**
+ * Retrieve Wishlist model
+ *
+ * @return Mage_Wishlist_Model_Wishlist
+ */
+ protected function _getWishlist()
+ {
+ if (is_null($this->_wishlist)) {
+ if (Mage::registry('shared_wishlist')) {
+ $this->_wishlist = Mage::registry('shared_wishlist');
+ }
+ elseif (Mage::registry('wishlist')) {
+ $this->_wishlist = Mage::registry('wishlist');
+ }
+ else {
+ $this->_wishlist = Mage::getModel('wishlist/wishlist');
+ if ($this->_getCustomerSession()->isLoggedIn()) {
+ $this->_wishlist->loadByCustomer($this->_getCustomerSession()->getCustomer());
+ }
+ }
+ }
+ return $this->_wishlist;
+ }
+
+ /**
+ * Prepare additional conditions to collection
+ *
+ * @param Mage_Wishlist_Model_Mysql4_Product_Collection $collection
+ * @return Mage_Wishlist_Block_Customer_Wishlist
+ */
+ protected function _prepareCollection($collection)
+ {
+ return $this;
+ }
+
+ /**
+ * Retrieve Wishlist Product Items collection
+ *
+ * @return Mage_Wishlist_Model_Mysql4_Product_Collection
+ */
+ public function getWishlistItems()
+ {
+ if (is_null($this->_collection)) {
+ $attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
+ $this->_collection = $this->_getWishlist()
+ ->getProductCollection()
+ ->addAttributeToSelect($attributes)
+ ->addStoreFilter()
+ ->addUrlRewrite();
+
+ Mage::getSingleton('catalog/product_visibility')
+ ->addVisibleInSearchFilterToCollection($this->_collection);
+
+ $this->_prepareCollection($this->_collection);
+ }
+
+ return $this->_collection;
+ }
+
+ /**
+ * Back compatibility retrieve wishlist product items
+ *
+ * @deprecated
+ * @return Mage_Wishlist_Model_Mysql4_Product_Collection
+ */
+ public function getWishlist()
+ {
+ return $this->getWishlistItems();
+ }
+
+ /**
+ * Retrieve URL for Removing item from wishlist
+ *
+ * @param Mage_Catalog_Model_Product $item
+ * @return string
+ */
+ public function getItemRemoveUrl($product)
+ {
+ return $this->_getHelper()->getRemoveUrl($product);
+ }
+
+ /**
+ * Retrieve Add Item to shopping cart URL
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @return string
+ */
+ public function getItemAddToCartUrl($product)
+ {
+ return $this->_getHelper()->getAddToCartUrl($product);
+ }
+
+ /**
+ * Retrieve URL for adding Product to wishlist
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @return string
+ */
+ public function getAddToWishlistUrl($product)
+ {
+ return $this->_getHelper()->getAddUrl($product);
+ }
+
+ /**
+ * Retrieve Escaped Description for Wishlist Item
+ *
+ * @param Mage_Catalog_Model_Product $item
+ * @return string
+ */
+ public function getEscapedDescription($item)
+ {
+ if ($item->getWishlistItemDescription()) {
+ return $this->htmlEscape($item->getWishlistItemDescription());
+ }
+ return ' ';
+ }
+
+ /**
+ * Check Wishlist item has description
+ *
+ * @param Mage_Catalog_Model_Product $item
+ * @return bool
+ */
+ public function hasDescription($item)
+ {
+ return trim($item->getWishlistItemDescription()) != '';
+ }
+
+ /**
+ * Retrieve formated Date
+ *
+ * @param string $date
+ * @return string
+ */
+ public function getFormatedDate($date)
+ {
+ return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
+ }
+
+ /**
+ * Check is the wishlist has a salable product(s)
+ *
+ * @return bool
+ */
+ public function isSaleable()
+ {
+ foreach ($this->getWishlistItems() as $item) {
+ if ($item->isSaleable()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Retrieve wishlist loaded items count
+ *
+ * @return int
+ */
+ public function getWishlistItemsCount()
+ {
+ return $this->getWishlistItems()->count();
+ }
+
+ /**
+ * Check is the wishlist has items
+ *
+ * @return bool
+ */
+ public function hasWishlistItems()
+ {
+ return $this->getWishlistItemsCount() > 0;
+ }
+}
diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Sharing.php b/app/code/core/Mage/Wishlist/Block/Customer/Sharing.php
index 2b16e29565..415e9bd92a 100644
--- a/app/code/core/Mage/Wishlist/Block/Customer/Sharing.php
+++ b/app/code/core/Mage/Wishlist/Block/Customer/Sharing.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Wishlist
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -30,36 +30,58 @@
*
* @category Mage
* @package Mage_Wishlist
- * @author Magento Core Team
+ * @author Magento Core Team
*/
class Mage_Wishlist_Block_Customer_Sharing extends Mage_Core_Block_Template
{
-
+ /**
+ * Entered Data cache
+ *
+ * @param array
+ */
protected $_enteredData = null;
+ /**
+ * Prepare Global Layout
+ *
+ * @return Mage_Wishlist_Block_Customer_Sharing
+ */
protected function _prepareLayout()
{
- if ($headBlock = $this->getLayout()->getBlock('head')) {
+ $headBlock = $this->getLayout()->getBlock('head');
+ if ($headBlock) {
$headBlock->setTitle($this->__('Wishlist Sharing'));
}
}
+ /**
+ * Retrieve Send Form Action URL
+ *
+ * @return string
+ */
public function getSendUrl()
{
return $this->getUrl('*/*/send');
}
+ /**
+ * Retrieve Entered Data by key
+ *
+ * @param string $key
+ * @return mixed
+ */
public function getEnteredData($key)
{
- if(is_null($this->_enteredData)) {
- $this->_enteredData = Mage::getSingleton('wishlist/session')->getData('sharing_form', true);
+ if (is_null($this->_enteredData)) {
+ $this->_enteredData = Mage::getSingleton('wishlist/session')
+ ->getData('sharing_form', true);
}
- if(!$this->_enteredData || !isset($this->_enteredData[$key])) {
+ if (!$this->_enteredData || !isset($this->_enteredData[$key])) {
return null;
- } else {
+ }
+ else {
return $this->htmlEscape($this->_enteredData[$key]);
}
}
-
}
diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php b/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php
index 6906cd6b92..82ea5b01c9 100644
--- a/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php
+++ b/app/code/core/Mage/Wishlist/Block/Customer/Sidebar.php
@@ -20,70 +20,79 @@
*
* @category Mage
* @package Mage_Wishlist
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+
/**
* Wishlist sidebar block
*
* @category Mage
* @package Mage_Wishlist
- * @author Magento Core Team
+ * @author Magento Core Team
*/
-
-class Mage_Wishlist_Block_Customer_Sidebar extends Mage_Catalog_Block_Product_Abstract
+class Mage_Wishlist_Block_Customer_Sidebar extends Mage_Wishlist_Block_Abstract
{
- protected $_wishlist = null;
-
- public function getWishlistItems()
- {
- return $this->getWishlist()->getProductCollection();
- }
-
- public function getWishlist()
+ /**
+ * Add sidebar conditions to collection
+ *
+ * @param Mage_Wishlist_Model_Mysql4_Product_Collection $collection
+ * @return Mage_Wishlist_Block_Customer_Wishlist
+ */
+ protected function _prepareCollection($collection)
{
- if(is_null($this->_wishlist)) {
- $this->_wishlist = Mage::getModel('wishlist/wishlist')
- ->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer());
-
- $collection = $this->_wishlist->getProductCollection()
- ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
- //->addAttributeToFilter('store_id', array('in'=>$this->_wishlist->getSharedStoreIds()))
- ->addStoreFilter()
- ->addAttributeToSort('added_at', 'desc')
- ->setCurPage(1)
- ->setPageSize(3)
- ->addUrlRewrite();
+ $collection->setPage(1, 3);
+ $collection->addAttributeToSort('added_at', 'desc');
- Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
- Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
- }
-
- return $this->_wishlist;
+ return $this;
}
+ /**
+ * Prepare before to html
+ *
+ * @return string
+ */
protected function _toHtml()
{
- if( sizeof($this->getWishlistItems()->getItems()) > 0 ){
+ if ($this->_getHelper()->hasItems()) {
return parent::_toHtml();
- } else {
- return '';
}
+
+ return '';
}
+ /**
+ * Can Display wishlist
+ *
+ * @return bool
+ */
public function getCanDisplayWishlist()
{
- return Mage::getSingleton('customer/session')->isLoggedIn();
+ return $this->_getCustomerSession()->isLoggedIn();
}
+ /**
+ * Retrieve URL for removing item from wishlist
+ *
+ * @deprecated back compatibility alias for getItemRemoveUrl
+ * @param Mage_Wishlist_Model_Item $item
+ * @return string
+ */
public function getRemoveItemUrl($item)
{
- return $this->getUrl('wishlist/index/remove',array('item'=>$item->getWishlistItemId()));
+ return $this->getItemRemoveUrl($item);
}
- public function getAddToCartItemUrl($item)
+ /**
+ * Retrieve URL for adding product to shopping cart and remove item from wishlist
+ *
+ * @deprecated
+ * @param Mage_Catalog_Model_Product $product
+ * @return string
+ */
+ public function getAddToCartItemUrl($product)
{
- return Mage::helper('wishlist')->getAddToCartUrlBase64($item);
+ return $this->getItemAddToCartUrl($product);
}
}
diff --git a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist.php b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist.php
index 3edbc53bf8..346f24fd57 100644
--- a/app/code/core/Mage/Wishlist/Block/Customer/Wishlist.php
+++ b/app/code/core/Mage/Wishlist/Block/Customer/Wishlist.php
@@ -32,58 +32,27 @@
* @package Mage_Wishlist
* @author Magento Core Team
*/
-class Mage_Wishlist_Block_Customer_Wishlist extends Mage_Catalog_Block_Product_Abstract
+class Mage_Wishlist_Block_Customer_Wishlist extends Mage_Wishlist_Block_Abstract
{
-
- protected $_wishlistLoaded = false;
-
+ /**
+ * Preparing global layout
+ *
+ * @return Mage_Wishlist_Block_Customer_Wishlist
+ */
protected function _prepareLayout()
{
- if ($headBlock = $this->getLayout()->getBlock('head')) {
+ parent::_prepareLayout();
+ $headBlock = $this->getLayout()->getBlock('head');
+ if ($headBlock) {
$headBlock->setTitle($this->__('My Wishlist'));
}
}
- public function getWishlist()
- {
- if(!$this->_wishlistLoaded) {
- Mage::registry('wishlist')
- ->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer());
-
- $collection = Mage::registry('wishlist')->getProductCollection()
- ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
- //->addAttributeToFilter('store_id', array('in'=>Mage::registry('wishlist')->getSharedStoreIds()))
- ->addStoreFilter();
-
- Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
- Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($collection);
-
- $this->_wishlistLoaded = true;
- }
-
- return Mage::registry('wishlist')->getProductCollection();
- }
-
- public function getEscapedDescription(Varien_Object $item)
- {
- return $this->htmlEscape($item->getWishlistItemDescription());
- }
-
- public function getFormatedDate($date)
- {
- return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
- }
-
- public function getItemAddToCartUrl($item)
- {
- return $this->getUrl('*/*/cart',array('item'=>$item->getWishlistItemId()));
- }
-
- public function getItemRemoveUrl($item)
- {
- return $this->getUrl('*/*/remove',array('item'=>$item->getWishlistItemId()));
- }
-
+ /**
+ * Retrieve Back URL
+ *
+ * @return string
+ */
public function getBackUrl()
{
if ($this->getRefererUrl()) {
@@ -91,15 +60,4 @@ public function getBackUrl()
}
return $this->getUrl('customer/account/');
}
-
- public function isSaleable()
- {
- foreach ($this->getWishlist() as $item) {
- if ($item->isSaleable()) {
- return true;
- }
- }
-
- return false;
- }
}
diff --git a/app/code/core/Mage/Wishlist/Block/Links.php b/app/code/core/Mage/Wishlist/Block/Links.php
index b9ece3036f..05314c47a5 100644
--- a/app/code/core/Mage/Wishlist/Block/Links.php
+++ b/app/code/core/Mage/Wishlist/Block/Links.php
@@ -44,15 +44,17 @@ public function addWishlistLink()
$parentBlock = $this->getParentBlock();
if ($parentBlock && $this->helper('wishlist')->isAllow()) {
$count = $this->helper('wishlist')->getItemCount();
- if( $count > 1 ) {
+ if ($count > 1) {
$text = $this->__('My Wishlist (%d items)', $count);
- } elseif( $count == 1 ) {
+ }
+ else if ($count == 1) {
$text = $this->__('My Wishlist (%d item)', $count);
- } else {
+ }
+ else {
$text = $this->__('My Wishlist');
}
$parentBlock->addLink($text, 'wishlist', $text, true, array(), 30, null, 'class="top-link-wishlist"');
}
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Wishlist/Block/Share/Email/Items.php b/app/code/core/Mage/Wishlist/Block/Share/Email/Items.php
index d235ab0cf6..4a426f73e8 100644
--- a/app/code/core/Mage/Wishlist/Block/Share/Email/Items.php
+++ b/app/code/core/Mage/Wishlist/Block/Share/Email/Items.php
@@ -32,54 +32,42 @@
* @package Mage_Wishlist
* @author Magento Core Team
*/
-class Mage_Wishlist_Block_Share_Email_Items extends Mage_Core_Block_Template
+class Mage_Wishlist_Block_Share_Email_Items extends Mage_Wishlist_Block_Abstract
{
-
- protected $_wishlistLoaded = false;
-
+ /**
+ * Initialize template
+ *
+ */
public function __construct()
{
parent::__construct();
$this->setTemplate('wishlist/email/items.phtml');
}
- public function getWishlist()
+ /**
+ * Retrieve Product View URL
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @param array $additional
+ * @return string
+ */
+ public function getProductUrl($product, $additional = array())
{
- if(!$this->_wishlistLoaded) {
- Mage::registry('wishlist')
- ->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer());
- Mage::registry('wishlist')->getProductCollection()
- ->addAttributeToSelect('url_key')
- ->addAttributeToSelect('name')
- ->addAttributeToSelect('price')
- ->addAttributeToSelect('image')
- ->addAttributeToSelect('small_image')
- //->addAttributeToFilter('store_id', array('in'=>Mage::registry('wishlist')->getSharedStoreIds()))
- ->addStoreFilter();
- Mage::getSingleton('catalog/product_visibility')
- ->addVisibleInSiteFilterToCollection(Mage::registry('wishlist')->getProductCollection());
- Mage::registry('wishlist')->getProductCollection()
- ->load();
-
- $this->_wishlistLoaded = true;
- }
-
- return Mage::registry('wishlist')->getProductCollection();
+ $additional['_store_to_url'] = true;
+ return parent::getProductUrl($product, $additional);
}
- public function getEscapedDescription(Varien_Object $item)
+ /**
+ * Retrieve URL for add product to shopping cart
+ *
+ * @param Mage_Catalog_Model_Product $product
+ * @param array $additional
+ * @return string
+ */
+ public function getAddToCartUrl($product, $additional = array())
{
- return nl2br($this->htmlEscape($item->getWishlistItemDescription()));
+ $additional['nocookie'] = 1;
+ $additional['_store_to_url'] = true;
+ return parent::getAddToCartUrl($product, $additional);
}
-
- public function hasDescription(Varien_Object $item)
- {
- return trim($item->getWishlistItemDescription())!='';
- }
-
- public function getFormatedDate($date)
- {
- return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
- }
-
}
diff --git a/app/code/core/Mage/Wishlist/Block/Share/Email/Rss.php b/app/code/core/Mage/Wishlist/Block/Share/Email/Rss.php
index 800a278ee9..d82541adcf 100644
--- a/app/code/core/Mage/Wishlist/Block/Share/Email/Rss.php
+++ b/app/code/core/Mage/Wishlist/Block/Share/Email/Rss.php
@@ -20,17 +20,17 @@
*
* @category Mage
* @package Mage_Wishlist
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
- * Wishlist block customer items
+ * Wishlist RSS URL to Email Block
*
* @category Mage
* @package Mage_Wishlist
- * @author Magento Core Team
+ * @author Magento Core Team
*/
class Mage_Wishlist_Block_Share_Email_Rss extends Mage_Core_Block_Template
{
@@ -39,4 +39,4 @@ public function __construct()
parent::__construct();
$this->setTemplate('wishlist/email/rss.phtml');
}
-}
\ No newline at end of file
+}
diff --git a/app/code/core/Mage/Wishlist/Block/Share/Wishlist.php b/app/code/core/Mage/Wishlist/Block/Share/Wishlist.php
index ff2d3d3a0d..48c5f32de0 100644
--- a/app/code/core/Mage/Wishlist/Block/Share/Wishlist.php
+++ b/app/code/core/Mage/Wishlist/Block/Share/Wishlist.php
@@ -20,7 +20,7 @@
*
* @category Mage
* @package Mage_Wishlist
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
@@ -30,80 +30,56 @@
*
* @category Mage
* @package Mage_Wishlist
- * @author Magento Core Team
+ * @author Magento Core Team
*/
-class Mage_Wishlist_Block_Share_Wishlist extends Mage_Catalog_Block_Product_Abstract
+class Mage_Wishlist_Block_Share_Wishlist extends Mage_Wishlist_Block_Abstract
{
-
- protected $_collection = null;
+ /**
+ * Customer instance
+ *
+ * @var Mage_Customer_Model_Customer
+ */
protected $_customer = null;
+ /**
+ * Prepare global layout
+ *
+ * @return Mage_Wishlist_Block_Share_Wishlist
+ *
+ */
protected function _prepareLayout()
{
- if ($headBlock = $this->getLayout()->getBlock('head')) {
- $headBlock->setTitle($this->getHeader());
- }
- }
-
- public function getWishlist()
- {
- if(is_null($this->_collection)) {
- $this->_collection = Mage::registry('shared_wishlist')->getProductCollection()
- ->addAttributeToSelect('name')
- ->addAttributeToSelect('price')
- ->addAttributeToSelect('special_price')
- ->addAttributeToSelect('special_from_date')
- ->addAttributeToSelect('special_to_date')
- ->addAttributeToSelect('image')
- ->addAttributeToSelect('small_image')
- ->addAttributeToSelect('thumbnail')
- //->addAttributeToFilter('store_id', array('in'=>Mage::registry('shared_wishlist')->getSharedStoreIds()))
- ->addStoreFilter();
+ parent::_prepareLayout();
- Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($this->_collection);
- Mage::getSingleton('catalog/product_visibility')->addVisibleInSiteFilterToCollection($this->_collection);
+ $headBlock = $this->getLayout()->getBlock('head');
+ if ($headBlock) {
+ $headBlock->setTitle($this->getHeader());
}
- return $this->_collection;
+ return $this;
}
+ /**
+ * Retrieve Shared Wishlist Customer instance
+ *
+ * @return Mage_Customer_Model_Customer
+ */
public function getWishlistCustomer()
{
- if(is_null($this->_customer)) {
+ if (is_null($this->_customer)) {
$this->_customer = Mage::getModel('customer/customer')
- ->load(Mage::registry('shared_wishlist')->getCustomerId());
-
+ ->load($this->_getWishlist()->getCustomerId());
}
return $this->_customer;
}
-
- public function getEscapedDescription($item)
- {
- if ($item->getWishlistItemDescription()) {
- return $this->htmlEscape($item->getWishlistItemDescription());
- }
- return ' ';
- }
-
+ /**
+ * Retrieve Page Header
+ *
+ * @return string
+ */
public function getHeader()
{
return Mage::helper('wishlist')->__("%s's Wishlist", $this->htmlEscape($this->getWishlistCustomer()->getFirstname()));
}
-
- public function getFormatedDate($date)
- {
- return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
- }
-
- public function isSaleable()
- {
- foreach ($this->getWishlist() as $item) {
- if ($item->isSaleable()) {
- return true;
- }
- }
-
- return false;
- }
}
diff --git a/app/code/core/Mage/Wishlist/Helper/Data.php b/app/code/core/Mage/Wishlist/Helper/Data.php
index 3a461d1c55..298815c940 100644
--- a/app/code/core/Mage/Wishlist/Helper/Data.php
+++ b/app/code/core/Mage/Wishlist/Helper/Data.php
@@ -20,20 +20,32 @@
*
* @category Mage
* @package Mage_Wishlist
- * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
+
/**
- * Base wishlist helper
+ * Wishlist Data Helper
*
- * @author Magento Core Team
+ * @category Mage
+ * @package Mage_Wishlist
+ * @author Magento Core Team
*/
class Mage_Wishlist_Helper_Data extends Mage_Core_Helper_Abstract
{
+ /**
+ * Customer Wishlist instance
+ *
+ * @var Mage_Wishlist_Model_Wishlist
+ */
protected $_wishlist = null;
- protected $_itemCount = null;
- protected $_itemCollection = null;
+
+ /**
+ * Wishlist Product Items Collection
+ *
+ * @var Mage_Wishlist_Model_Mysql4_Product_Collection
+ */
protected $_productCollection = null;
/**
@@ -65,7 +77,7 @@ public function getWishlist()
{
if (is_null($this->_wishlist)) {
$this->_wishlist = Mage::getModel('wishlist/wishlist')
- ->loadByCustomer($this->_getCurrentCustomer());
+ ->loadByCustomer($this->_getCurrentCustomer());
}
return $this->_wishlist;
}
@@ -77,7 +89,7 @@ public function getWishlist()
*/
public function hasItems()
{
- return $this->getItemCount();
+ return $this->getItemCount() > 0;
}
/**
@@ -87,98 +99,133 @@ public function hasItems()
*/
public function getItemCount()
{
- if ($this->_isCustomerLogIn() && is_null($this->_itemCount)) {
- $this->_itemCount = $this->getWishlist()->getItemsCount();
- }
- elseif(is_null($this->_itemCount)) {
- $this->_itemCount = 0;
+ if (!Mage::getSingleton('customer/session')->hasWishlistItemCount()) {
+ $this->calculate();
}
- return $this->_itemCount;
+
+ return Mage::getSingleton('customer/session')->getWishlistItemCount();
}
/**
- * Retrieve wishlist items collection
+ * Retrieve wishlist product items collection
*
- * @return
+ * alias for getProductCollection
+ *
+ * @return Mage_Wishlist_Model_Mysql4_Product_Collection
*/
public function getItemCollection()
{
- if (is_null($this->_itemCollection)) {
- $this->_itemCollection = $this->getWishlist()->getProductCollection();
- }
- return $this->_itemCollection;
+ return $this->getProductCollection();
}
+ /**
+ * Retrieve wishlist product items collection
+ *
+ * @return Mage_Wishlist_Model_Mysql4_Product_Collection
+ */
public function getProductCollection()
{
if (is_null($this->_productCollection)) {
- $this->_productCollection = $this->getWishlist()->getProductCollection();
+ $this->_productCollection = $this->getWishlist()
+ ->getProductCollection();
+
+ Mage::getSingleton('catalog/product_visibility')
+ ->addVisibleInSearchFilterToCollection($this->_productCollection);
}
return $this->_productCollection;
}
-
- public function getSharingUrl()
+ /**
+ * Retrieve Item Store for URL
+ *
+ * @param Mage_Catalog_Model_Product|Mage_Wishlist_Model_Item $item
+ * @return Mage_Core_Model_Store
+ */
+ protected function _getUrlStore($item)
{
-
+ $storeId = null;
+ if ($item instanceof Mage_Catalog_Model_Product) {
+ if ($item->isVisibleInSiteVisibility()) {
+ $storeId = $item->getStoreId();
+ }
+ else if ($item->hasUrlDataObject()) {
+ $storeId = $item->getUrlDataObject()->getStoreId();
+ }
+ }
+ return Mage::app()->getStore($storeId);
}
/**
- * Retrieve url for removing item from wishlist
+ * Retrieve URL for removing item from wishlist
*
- * @param Mage_Wishlist_Model_Item $item
- * @return string
+ * @param Mage_Catalog_Model_Product|Mage_Wishlist_Model_Item $item
+ * @return string
*/
public function getRemoveUrl($item)
{
- return $this->_getUrl('wishlist/index/remove', array('item'=>$item->getWishlistItemId()));
+ return $this->_getUrl('wishlist/index/remove', array(
+ 'item' => $item->getWishlistItemId()
+ ));
}
/**
* Retrieve url for adding product to wishlist
*
- * @param mixed $product
+ * @param Mage_Catalog_Model_Product|Mage_Wishlist_Model_Item $product
* @return string
*/
public function getAddUrl($item)
{
+ $productId = null;
if ($item instanceof Mage_Catalog_Model_Product) {
- return $this->_getUrl('wishlist/index/add', array('product'=>$item->getId()));
+ $productId = $item->getEntityId();
}
if ($item instanceof Mage_Wishlist_Model_Item) {
- return $this->_getUrl('wishlist/index/add', array('product'=>$item->getProductId()));
+ $productId = $item->getProductId();
+ }
+
+ if ($productId) {
+ return $this->_getUrlStore($item)->getUrl('wishlist/index/add', array(
+ 'product' => $productId
+ ));
}
+
return false;
}
/**
- * Retrieve url for adding item to shoping cart
+ * Retrieve URL for adding item to shoping cart
*
- * @param Mage_Wishlist_Model_Item $item
+ * @param Mage_Catalog_Model_Product|Mage_Wishlist_Model_Item $item
* @return string
*/
public function getAddToCartUrl($item)
{
- return $this->_getUrl('wishlist/index/cart', array('item'=>$item->getWishlistItemId()));
+ $urlParamName = Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED;
+ $continueUrl = Mage::helper('core')->urlEncode(Mage::getUrl('*/*/*', array(
+ '_current' => true,
+ '_use_rewrite' => true,
+ '_store_to_url' => true,
+ )));
+
+ return $this->_getUrlStore($item)->getUrl('wishlist/index/cart', array(
+ 'item' => $item->getWishlistItemId(),
+ $urlParamName => $continueUrl
+ ));
}
/**
* Retrieve url for adding item to shoping cart with b64 referer
*
- * @param Mage_Wishlist_Model_Item $item
+ * @deprecated
+ * @param Mage_Catalog_Model_Product|Mage_Wishlist_Model_Item $item
* @return string
*/
public function getAddToCartUrlBase64($item)
{
- return $this->_getUrl('wishlist/index/cart', array(
- 'item'=>$item->getWishlistItemId(),
- Mage_Core_Controller_Front_Action::PARAM_NAME_BASE64_URL => Mage::helper('core')->urlEncode(
- $this->_getUrl('*/*/*', array('_current'=>true))
- )
- ));
+ return $this->getAddToCartUrl($item);
}
-
/**
* Retrieve customer wishlist url
*
@@ -189,41 +236,90 @@ public function getListUrl()
return $this->_getUrl('wishlist');
}
+ /**
+ * Check is allow wishlist module
+ *
+ * @return bool
+ */
public function isAllow()
{
- if (Mage::getStoreConfig('wishlist/general/active')) {
- return true;
- }
- return false;
+ if ($this->isModuleOutputEnabled() && Mage::getStoreConfig('wishlist/general/active')) {
+ return true;
+ }
+ return false;
}
+ /**
+ * Check is allow wishlist action in shopping cart
+ *
+ * @return bool
+ */
public function isAllowInCart()
{
return $this->isAllow() && $this->_isCustomerLogIn();
}
+ /**
+ * Retrieve customer name
+ *
+ * @return string
+ */
public function getCustomerName()
{
return $this->_getCurrentCustomer()->getName();
}
+ /**
+ * Retrieve RSS URL
+ *
+ * @return string
+ */
public function getRssUrl()
{
$customer = $this->_getCurrentCustomer();
$key = $customer->getId().','.$customer->getEmail();
- return $this->_getUrl('rss/index/wishlist',array('data' => Mage::helper('core')->urlEncode($key), '_secure' => false));
+ return $this->_getUrl('rss/index/wishlist', array('data' => Mage::helper('core')->urlEncode($key), '_secure' => false));
}
+ /**
+ * Is allow RSS
+ *
+ * @return bool
+ */
public function isRssAllow()
{
- if (Mage::getStoreConfig('rss/wishlist/active')) {
- return true;
- }
- return false;
+ if (Mage::getStoreConfig('rss/wishlist/active')) {
+ return true;
+ }
+ return false;
}
+ /**
+ * Retrieve default empty comment message
+ *
+ * @return string
+ */
public function defaultCommentString()
{
return $this->__('Please, enter your comments...');
}
+
+ /**
+ * Calculate count of wishlist items
+ *
+ * @return Mage_Wishlist_Helper_Data
+ */
+ public function calculate()
+ {
+ if (!$this->_isCustomerLogIn()) {
+ $count = 0;
+ }
+ else {
+ $count = $this->getProductCollection()
+ ->getSize();
+ }
+ Mage::getSingleton('customer/session')->setWishlistItemCount($count);
+
+ return $this;
+ }
}
diff --git a/app/code/core/Mage/Wishlist/Model/Mysql4/Product/Collection.php b/app/code/core/Mage/Wishlist/Model/Mysql4/Product/Collection.php
index 5273235ca4..bb6bbdfc40 100644
--- a/app/code/core/Mage/Wishlist/Model/Mysql4/Product/Collection.php
+++ b/app/code/core/Mage/Wishlist/Model/Mysql4/Product/Collection.php
@@ -43,33 +43,34 @@ class Mage_Wishlist_Model_Mysql4_Product_Collection
*/
public function addWishlistFilter(Mage_Wishlist_Model_Wishlist $wishlist)
{
- $this->_joinFields['e_id'] = array(
- 'table' => 'e',
- 'field' => 'entity_id'
- );
-
- $this->joinTable('wishlist/item',
- 'product_id=e_id',
+ $this->joinTable(
+ array('t_wi' => 'wishlist/item'),
+ 'product_id=entity_id',
array(
- 'product_id' => 'product_id',
+ 'product_id' => 'product_id',
'wishlist_item_description' => 'description',
- 'store_id' => 'store_id',
- 'added_at' => 'added_at',
- 'wishlist_id' => 'wishlist_id',
- 'wishlist_item_id' => 'wishlist_item_id',
+ 'item_store_id' => 'store_id',
+ 'added_at' => 'added_at',
+ 'wishlist_id' => 'wishlist_id',
+ 'wishlist_item_id' => 'wishlist_item_id',
),
array(
- 'wishlist_id' => $wishlist->getId(),
- 'store_id' => array('in' => $wishlist->getSharedStoreIds())
+ 'wishlist_id' => $wishlist->getId()
)
);
+
+ $this->_productLimitationFilters['store_table'] = 't_wi';
+
+ $this->setFlag('url_data_object', true);
+ $this->setFlag('do_not_use_category_id', true);
+
return $this;
}
/**
* Add wishlist sort order
*
- * @param string $att
+ * @param string $attribute
* @param string $dir
* @return Mage_Wishlist_Model_Mysql4_Product_Collection
*/
diff --git a/app/code/core/Mage/Wishlist/Model/Observer.php b/app/code/core/Mage/Wishlist/Model/Observer.php
index 982af932d6..11e7fb478d 100644
--- a/app/code/core/Mage/Wishlist/Model/Observer.php
+++ b/app/code/core/Mage/Wishlist/Model/Observer.php
@@ -133,4 +133,30 @@ public function processAddToCart($observer)
Mage::getSingleton('checkout/session')->setNoCartRedirect(true);
}
}
+
+ /**
+ * Customer login processing
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Wishlist_Model_Observer
+ */
+ public function customerLogin(Varien_Event_Observer $observer)
+ {
+ Mage::helper('wishlist')->calculate();
+
+ return $this;
+ }
+
+/**
+ * Customer logout processing
+ *
+ * @param Varien_Event_Observer $observer
+ * @return Mage_Wishlist_Model_Observer
+ */
+ public function customerLogout(Varien_Event_Observer $observer)
+ {
+ Mage::getSingleton('customer/session')->setWishlistItemCount(0);
+
+ return $this;
+ }
}
\ No newline at end of file
diff --git a/app/code/core/Mage/Wishlist/controllers/IndexController.php b/app/code/core/Mage/Wishlist/controllers/IndexController.php
index e4703df373..a46ccfb150 100644
--- a/app/code/core/Mage/Wishlist/controllers/IndexController.php
+++ b/app/code/core/Mage/Wishlist/controllers/IndexController.php
@@ -129,6 +129,9 @@ public function addAction()
else {
$referer = $this->_getRefererUrl();
}
+
+ Mage::helper('wishlist')->calculate();
+
$message = $this->__('%1$s was successfully added to your wishlist. Click here to continue shopping', $product->getName(), $referer);
$session->addSuccess($message);
}
@@ -197,33 +200,66 @@ public function removeAction()
);
}
}
+
+ Mage::helper('wishlist')->calculate();
+
$this->_redirectReferer(Mage::getUrl('*/*'));
}
/**
- * Add wishlist item to shopping cart
+ * Add wishlist item to shopping cart and remove from wishlist
+ *
+ * If Product has required options - item removed from wishlist and redirect
+ * to product view page with message about needed defined required options
+ *
*/
public function cartAction()
{
$wishlist = $this->_getWishlist();
- $id = (int) $this->getRequest()->getParam('item');
- $item = Mage::getModel('wishlist/item')->load($id);
+ $itemId = (int)$this->getRequest()->getParam('item');
+ /* @var $item Mage_Wishlist_Model_Item */
+ $item = Mage::getModel('wishlist/item')->load($itemId);
- if($item->getWishlistId()==$wishlist->getId()) {
+ if ($item->getWishlistId() == $wishlist->getId()) {
try {
- $product = Mage::getModel('catalog/product')->load($item->getProductId())->setQty(1);
- $quote = Mage::getSingleton('checkout/cart')
+ /* @var $product Mage_Catalog_Model_Product */
+ $product = Mage::getModel('catalog/product')
+ ->load($item->getProductId())
+ ->setQty(1);
+
+ if ($product->getTypeInstance(true)->hasRequiredOptions($product)) {
+ $url = $product->getProductUrl();
+ $sep = (strpos($url, '?') !== false) ? '&' : '?';
+ $url = $url . $sep . 'options=cart';
+
+ $item->delete();
+ Mage::helper('wishlist')->calculate();
+
+ $this->_redirectUrl($url);
+ return;
+ }
+
+ Mage::getSingleton('checkout/cart')
->addProduct($product)
->save();
+
$item->delete();
+ Mage::helper('wishlist')->calculate();
}
- catch(Exception $e) {
- Mage::getSingleton('checkout/session')->addError($e->getMessage());
+ catch (Exception $e) {
+ if ($e instanceof Mage_Core_Exception) {
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
+ }
+ else {
+ Mage::getSingleton('checkout/session')->addException($e,
+ Mage::helper('wishlist')->__('Can not add item to shopping cart'));
+ }
+
$url = Mage::getSingleton('checkout/session')->getRedirectUrl(true);
if ($url) {
- $url = Mage::getModel('core/url')->getUrl('catalog/product/view', array(
- 'id'=>$item->getProductId(),
- 'wishlist_next'=>1
+ $url = Mage::getUrl('catalog/product/view', array(
+ 'id' => $item->getProductId(),
+ 'wishlist_next' => 1
));
Mage::getSingleton('checkout/session')->setSingleWishlistId($item->getId());
$this->getResponse()->setRedirect($url);
@@ -237,19 +273,24 @@ public function cartAction()
if (Mage::getStoreConfig('checkout/cart/redirect_to_cart')) {
$this->_redirect('checkout/cart');
- } else {
+ }
+ else {
if ($this->getRequest()->getParam(self::PARAM_NAME_BASE64_URL)) {
$this->getResponse()->setRedirect(
Mage::helper('core')->urlDecode($this->getRequest()->getParam(self::PARAM_NAME_BASE64_URL))
);
- } else {
+ }
+ else {
$this->_redirect('*/*/');
}
}
}
/**
- * Add all items to shoping cart
+ * Add all items from wishlist to shopping cart
+ *
+ * If wishlist has products with required options
+ * remove it from wishlist and redirect to product view page
*
*/
public function allcartAction() {
@@ -258,38 +299,62 @@ public function allcartAction() {
$wishlistIds = array();
$notSalableNames = array(); // Out of stock products message
- $wishlist = $this->_getWishlist();
- $wishlist->getItemCollection()->load();
+ $wishlist = $this->_getWishlist();
+ $collection = $wishlist->getItemCollection()->load();
+ /* @var $cart Mage_Checkout_Model_Cart */
+ $cart = Mage::getSingleton('checkout/cart');
- foreach ($wishlist->getItemCollection() as $item) {
+ /* @var $item Mage_Wishlist_Model_Item */
+ foreach ($collection as $item) {
try {
+ /* @var $product Mage_Catalog_Model_Product */
$product = Mage::getModel('catalog/product')
->load($item->getProductId())
->setQty(1);
+
if ($product->isSalable()) {
- Mage::getSingleton('checkout/cart')->addProduct($product);
+ // check required options
+ if ($product->getTypeInstance(true)->hasRequiredOptions($product)) {
+ $url = $product->getUrlModel()->getUrl($product, array('_query' => array(
+ 'options' => 'cart'
+ )));
+
+ $item->delete();
+ Mage::helper('wishlist')->calculate();
+
+ $this->_redirectUrl($url);
+ return;
+ }
+
+ $cart->addProduct($product);
+ if (!$product->isVisibleInSiteVisibility()) {
+ $cart->getQuote()->getItemByProduct($product)
+ ->setStoreId($item->getStoreId());
+ }
+
$item->delete();
}
else {
$notSalableNames[] = $product->getName();
}
- } catch(Exception $e) {
- $url = Mage::getSingleton('checkout/session')
- ->getRedirectUrl(true);
+ }
+ catch (Exception $e) {
+ $url = Mage::getSingleton('checkout/session')->getRedirectUrl(true);
if ($url) {
- $url = Mage::getModel('core/url')
- ->getUrl('catalog/product/view', array(
- 'id' => $item->getProductId(),
- 'wishlist_next' => 1
- ));
+ $url = Mage::getUrl('catalog/product/view', array(
+ 'id' => $item->getProductId(),
+ 'wishlist_next' => 1
+ ));
$urls[] = $url;
$messages[] = $e->getMessage();
$wishlistIds[] = $item->getId();
- } else {
+ }
+ else {
$item->delete();
}
}
+
Mage::getSingleton('checkout/cart')->save();
}
@@ -299,6 +364,8 @@ public function allcartAction() {
array_map(array(Mage::getSingleton('checkout/session'), 'addNotice'), $notSalableNames);
}
+ Mage::helper('wishlist')->calculate();
+
if ($urls) {
Mage::getSingleton('checkout/session')->addError(array_shift($messages));
$this->getResponse()->setRedirect(array_shift($urls));
@@ -365,6 +432,7 @@ public function sendAction()
$wishlistBlock = $this->getLayout()->createBlock('wishlist/share_email_items')->toHtml();
$emails = array_unique($emails);
+ /* @var $emailModel Mage_Core_Model_Email_Template */
$emailModel = Mage::getModel('core/email_template');
foreach($emails as $email) {
@@ -376,9 +444,9 @@ public function sendAction()
array(
'customer' => $customer,
'salable' => $wishlist->isSalable() ? 'yes' : '',
- 'items' => &$wishlistBlock,
- 'addAllLink' => Mage::getUrl('*/shared/allcart',array('code'=>$wishlist->getSharingCode())),
- 'viewOnSiteLink'=> Mage::getUrl('*/shared/index',array('code'=>$wishlist->getSharingCode())),
+ 'items' => $wishlistBlock,
+ 'addAllLink' => Mage::getUrl('*/shared/allcart', array('code' => $wishlist->getSharingCode())),
+ 'viewOnSiteLink'=> Mage::getUrl('*/shared/index', array('code' => $wishlist->getSharingCode())),
'message' => $message
));
}
diff --git a/app/code/core/Mage/Wishlist/etc/config.xml b/app/code/core/Mage/Wishlist/etc/config.xml
index f0d030a988..316d9c74fe 100644
--- a/app/code/core/Mage/Wishlist/etc/config.xml
+++ b/app/code/core/Mage/Wishlist/etc/config.xml
@@ -28,7 +28,7 @@
- 0.7.4
+ 0.7.5
@@ -130,6 +130,26 @@
+
+
+
+
+ singleton
+ wishlist/observer
+ customerLogin
+
+
+
+
+
+
+ singleton
+ wishlist/observer
+ customerLogout
+
+
+
+
diff --git a/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.4-0.7.5.php
new file mode 100644
index 0000000000..4d16381aa1
--- /dev/null
+++ b/app/code/core/Mage/Wishlist/sql/wishlist_setup/mysql4-upgrade-0.7.4-0.7.5.php
@@ -0,0 +1,73 @@
+startSetup();
+
+$installer->getConnection()->dropForeignKey($installer->getTable('wishlist/item'), 'FK_WISHLIST_ITEM_STORE');
+$installer->getConnection()->dropForeignKey($installer->getTable('wishlist/item'), 'FK_ITEM_WISHLIST');
+$installer->getConnection()->dropForeignKey($installer->getTable('wishlist/item'), 'FK_WISHLIST_PRODUCT');
+$installer->getConnection()->dropForeignKey($installer->getTable('wishlist/wishlist'), 'FK_CUSTOMER');
+
+$installer->getConnection()->dropKey($installer->getTable('wishlist/item'), 'FK_ITEM_WISHLIST');
+$installer->getConnection()->dropKey($installer->getTable('wishlist/item'), 'FK_WISHLIST_PRODUCT');
+$installer->getConnection()->dropKey($installer->getTable('wishlist/item'), 'FK_WISHLIST_STORE');
+$installer->getConnection()->dropKey($installer->getTable('wishlist/wishlist'), 'FK_CUSTOMER');
+
+$installer->getConnection()->modifyColumn($installer->getTable('wishlist/item'), 'store_id',
+ 'smallint UNSIGNED DEFAULT NULL');
+
+$installer->getConnection()->addKey($installer->getTable('wishlist/item'), 'IDX_WISHLIST', 'wishlist_id');
+$installer->getConnection()->addKey($installer->getTable('wishlist/item'), 'IDX_PRODUCT', 'product_id');
+$installer->getConnection()->addKey($installer->getTable('wishlist/item'), 'IDX_STORE', 'store_id');
+$installer->getConnection()->addKey($installer->getTable('wishlist/wishlist'), 'UNQ_CUSTOMER', 'customer_id', 'unique');
+$installer->getConnection()->addKey($installer->getTable('wishlist/wishlist'), 'IDX_IS_SHARED', 'shared');
+
+$installer->getConnection()->addConstraint('FK_WISHLIST_ITEM_STORE',
+ $installer->getTable('wishlist/item'), 'store_id',
+ $installer->getTable('core/store'), 'store_id',
+ 'set null', 'cascade'
+);
+$installer->getConnection()->addConstraint('FK_WISHLIST_ITEM_WISHLIST',
+ $installer->getTable('wishlist/item'), 'wishlist_id',
+ $installer->getTable('wishlist/wishlist'), 'wishlist_id',
+ 'cascade', 'cascade'
+);
+$installer->getConnection()->addConstraint('FK_WISHLIST_ITEM_PRODUCT',
+ $installer->getTable('wishlist/item'), 'product_id',
+ $installer->getTable('catalog/product'), 'entity_id',
+ 'cascade', 'cascade'
+);
+$installer->getConnection()->addConstraint('FK_WISHLIST_CUSTOMER',
+ $installer->getTable('wishlist/wishlist'), 'customer_id',
+ $installer->getTable('customer/entity'), 'entity_id',
+ 'cascade', 'cascade'
+);
+
+$installer->endSetup();
diff --git a/app/design/adminhtml/default/default/layout/downloadable.xml b/app/design/adminhtml/default/default/layout/downloadable.xml
index 1b21994325..1bca5838ad 100644
--- a/app/design/adminhtml/default/default/layout/downloadable.xml
+++ b/app/design/adminhtml/default/default/layout/downloadable.xml
@@ -31,7 +31,6 @@
downloadable_items downloadable/adminhtml_catalog_product_edit_tab_downloadable
- downloadable_items customer_options
diff --git a/app/design/adminhtml/default/default/layout/main.xml b/app/design/adminhtml/default/default/layout/main.xml
index 90846eb814..c41de21af4 100644
--- a/app/design/adminhtml/default/default/layout/main.xml
+++ b/app/design/adminhtml/default/default/layout/main.xml
@@ -109,7 +109,9 @@ Default layout, loads most of the pages
-
+
+ http://www.magentocommerce.com/bug-tracking
+
diff --git a/app/design/adminhtml/default/default/layout/sales.xml b/app/design/adminhtml/default/default/layout/sales.xml
index 6ac9e5c095..82fe1921ec 100644
--- a/app/design/adminhtml/default/default/layout/sales.xml
+++ b/app/design/adminhtml/default/default/layout/sales.xml
@@ -46,17 +46,15 @@
-
+
+
order_info order_tab_info
@@ -103,18 +101,16 @@
-
-
+
+
+
@@ -149,18 +145,16 @@
name adminhtml/sales_items_column_name_grouped sales/items/column/name.phtml grouped
-
-
+
+
+
@@ -206,19 +200,17 @@
invoice
-
-
+
+
+
@@ -308,17 +300,16 @@
name adminhtml/sales_items_column_name_grouped sales/items/column/name.phtml grouped
-
-
+
+
+
+
@@ -346,17 +337,17 @@
name adminhtml/sales_items_column_name_grouped sales/items/column/name.phtml grouped
-
+
+
+
+
@@ -396,18 +387,16 @@
creditmemo
-
-
+
+
+
diff --git a/app/design/adminhtml/default/default/template/bundle/sales/creditmemo/create/items/renderer.phtml b/app/design/adminhtml/default/default/template/bundle/sales/creditmemo/create/items/renderer.phtml
index 8ca47db708..3335e7f0ce 100644
--- a/app/design/adminhtml/default/default/template/bundle/sales/creditmemo/create/items/renderer.phtml
+++ b/app/design/adminhtml/default/default/template/bundle/sales/creditmemo/create/items/renderer.phtml
@@ -75,9 +75,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -128,9 +128,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -246,9 +246,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -298,9 +298,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/bundle/sales/creditmemo/view/items/renderer.phtml b/app/design/adminhtml/default/default/template/bundle/sales/creditmemo/view/items/renderer.phtml
index 962a852f98..1ddc8f93cc 100644
--- a/app/design/adminhtml/default/default/template/bundle/sales/creditmemo/view/items/renderer.phtml
+++ b/app/design/adminhtml/default/default/template/bundle/sales/creditmemo/view/items/renderer.phtml
@@ -73,9 +73,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -126,9 +126,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -180,9 +180,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -232,9 +232,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/bundle/sales/invoice/create/items/renderer.phtml b/app/design/adminhtml/default/default/template/bundle/sales/invoice/create/items/renderer.phtml
index f521d37597..840fbe2fd3 100644
--- a/app/design/adminhtml/default/default/template/bundle/sales/invoice/create/items/renderer.phtml
+++ b/app/design/adminhtml/default/default/template/bundle/sales/invoice/create/items/renderer.phtml
@@ -74,9 +74,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -127,9 +127,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -234,9 +234,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -286,9 +286,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/bundle/sales/invoice/view/items/renderer.phtml b/app/design/adminhtml/default/default/template/bundle/sales/invoice/view/items/renderer.phtml
index 17410aa371..de98794db5 100644
--- a/app/design/adminhtml/default/default/template/bundle/sales/invoice/view/items/renderer.phtml
+++ b/app/design/adminhtml/default/default/template/bundle/sales/invoice/view/items/renderer.phtml
@@ -72,9 +72,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -125,9 +125,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -179,9 +179,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -231,9 +231,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/bundle/sales/order/view/items/renderer.phtml b/app/design/adminhtml/default/default/template/bundle/sales/order/view/items/renderer.phtml
index 550237b656..e6f7d7a971 100644
--- a/app/design/adminhtml/default/default/template/bundle/sales/order/view/items/renderer.phtml
+++ b/app/design/adminhtml/default/default/template/bundle/sales/order/view/items/renderer.phtml
@@ -91,9 +91,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -144,9 +144,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -240,9 +240,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -292,9 +292,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/catalog/category/edit.phtml b/app/design/adminhtml/default/default/template/catalog/category/edit.phtml
index 40da9ae757..c68ef3ce73 100644
--- a/app/design/adminhtml/default/default/template/catalog/category/edit.phtml
+++ b/app/design/adminhtml/default/default/template/catalog/category/edit.phtml
@@ -39,9 +39,9 @@
function categoryReset(url,useAjax){
if(useAjax){
var params = {active_tab_id:false};
- updateContent('getResetUrl() ?>', params);
+ updateContent(url, params);
}else{
- location.href = 'getResetUrl() ?>'
+ location.href = url;
}
}
function categoryDelete(url, useAjax){
diff --git a/app/design/adminhtml/default/default/template/catalog/category/edit/form.phtml b/app/design/adminhtml/default/default/template/catalog/category/edit/form.phtml
index b8a890a28b..b9bfc23e12 100644
--- a/app/design/adminhtml/default/default/template/catalog/category/edit/form.phtml
+++ b/app/design/adminhtml/default/default/template/catalog/category/edit/form.phtml
@@ -74,6 +74,53 @@
return false;
};
+ categoryForm.refreshPath = function () {
+
+ categoryId = this.getCategoryId();
+
+ if (!categoryId) {
+ return false;
+ }
+
+ var refreshPathSuccess = function(transport) {
+ if (transport.responseText.isJSON()) {
+ response = transport.responseText.evalJSON()
+ if (response.error) {
+ alert(response.message);
+ } else {
+ if (categoryForm.getCategoryId() == response['id']) {
+ categoryForm.setCategoryPath(response['path']);
+ }
+ }
+ }
+ };
+
+ new Ajax.Request(
+ 'getRefreshPathUrl() ?>',
+ {
+ method: 'POST',
+ evalScripts: true,
+ onSuccess: refreshPathSuccess
+ }
+ );
+
+ };
+
+ categoryForm.getCategoryId = function () {
+ collection = $(this.formId).getInputs('hidden','general[id]');
+ if (collection.size() > 0) {
+ return collection.first().value;
+ }
+ return false;
+ };
+
+ categoryForm.setCategoryPath = function (path) {
+ collection = $(this.formId).getInputs('hidden','general[path]');
+ if (collection.size() > 0) {
+ return collection.first().value = path;
+ }
+ };
+
function categorySubmit(url) {
var activeTab = $('active_tab_id');
if (activeTab) {
diff --git a/app/design/adminhtml/default/default/template/catalog/category/tree.phtml b/app/design/adminhtml/default/default/template/catalog/category/tree.phtml
index 053648f8db..5399171534 100644
--- a/app/design/adminhtml/default/default/template/catalog/category/tree.phtml
+++ b/app/design/adminhtml/default/default/template/catalog/category/tree.phtml
@@ -438,15 +438,19 @@ function categoryMove(obj)
var success = function(o) {
try {
- if(o.responseText && o.responseText!=='SUCCESS'){
- alert(o.responseText);
- location.reload();
+ if(o.responseText){
+ if(o.responseText==='SUCCESS'){
+ categoryForm.refreshPath();
+ } else {
+ alert(o.responseText);
+ location.reload();
+ }
}
}
catch(e) {
-
}
};
+
var failure = function(o) {
try {
console.log(o.statusText);
diff --git a/app/design/adminhtml/default/default/template/catalog/product/attribute/js.phtml b/app/design/adminhtml/default/default/template/catalog/product/attribute/js.phtml
index 2cbeb8e249..f180bf6b31 100644
--- a/app/design/adminhtml/default/default/template/catalog/product/attribute/js.phtml
+++ b/app/design/adminhtml/default/default/template/catalog/product/attribute/js.phtml
@@ -63,10 +63,10 @@ function bindAttributeInputType()
switchDefaultValueField();
checkIsConfigurableVisibility();
if($('frontend_input') && ($('frontend_input').value=='select' || $('frontend_input').value=='multiselect' || $('frontend_input').value=='price')){
- if($('is_filterable')){
+ if($('is_filterable') && !$('is_filterable').getAttribute('readonly')){
$('is_filterable').disabled = false;
}
- if($('is_filterable_in_search')){
+ if($('is_filterable_in_search') && !$('is_filterable_in_search').getAttribute('readonly')){
$('is_filterable_in_search').disabled = false;
}
if($('backend_type') && $('backend_type').options){
diff --git a/app/design/adminhtml/default/default/template/catalog/product/attribute/set/main.phtml b/app/design/adminhtml/default/default/template/catalog/product/attribute/set/main.phtml
index 57e804c3c2..670e6ecb64 100644
--- a/app/design/adminhtml/default/default/template/catalog/product/attribute/set/main.phtml
+++ b/app/design/adminhtml/default/default/template/catalog/product/attribute/set/main.phtml
@@ -270,7 +270,7 @@
for (var i in currentNode.childNodes ) {
if (currentNode.childNodes[i].id) {
child = editSet.currentNode.childNodes[i];
- if (child.attributes.is_used_in_configurable) {
+ if (child.attributes.is_configurable) {
return true;
}
}
@@ -369,12 +369,17 @@
},
rightBeforeAppend : function(tree, nodeThis, node, newParent) {
- if( node.attributes.is_user_defined == 1 ) {
- return true;
- } else {
+ if (node.attributes.is_user_defined == 0) {
alert('__('You cannot remove system attribute from this set.') ?>');
return false;
}
+ else if (node.attributes.is_configurable == 1) {
+ alert('__('This attribute is used in configurable products. You cannot remove it from the attribute set.') ?>');
+ return false;
+ }
+ else {
+ return true;
+ }
},
rightBeforeInsert : function(tree, nodeThis, node, newParent) {
@@ -383,12 +388,17 @@
return false;
}
- if( node.attributes.is_user_defined == 1 ) {
- return true;
- } else {
+ if (node.attributes.is_user_defined == 0) {
alert('__('You cannot remove system attribute from this set.') ?>');
return false;
}
+ else if (node.attributes.is_configurable == 1) {
+ alert('__('This attribute is used in configurable products. You cannot remove it from the attribute set.') ?>');
+ return false;
+ }
+ else {
+ return true;
+ }
},
groupBeforeInsert : function(tree, nodeThis, node, newParent) {
diff --git a/app/design/adminhtml/default/default/template/chronopay/form.phtml b/app/design/adminhtml/default/default/template/chronopay/form.phtml
new file mode 100644
index 0000000000..befa15b2af
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/chronopay/form.phtml
@@ -0,0 +1,81 @@
+
+
+getMethodCode() ?>
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/chronopay/info.phtml b/app/design/adminhtml/default/default/template/chronopay/info.phtml
new file mode 100644
index 0000000000..a3c9eece61
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/chronopay/info.phtml
@@ -0,0 +1,31 @@
+
+getMethod()->getTitle() ?>
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/adminhtml/default/default/template/chronopay/pdf/info.phtml b/app/design/adminhtml/default/default/template/chronopay/pdf/info.phtml
new file mode 100644
index 0000000000..fc1e76ed44
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/chronopay/pdf/info.phtml
@@ -0,0 +1,35 @@
+
+getMethod()->getTitle() ?>
+ {{pdf_row_separator}}
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+ {{pdf_row_separator}}
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+ {{pdf_row_separator}}
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+ {{pdf_row_separator}}
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/adminhtml/default/default/template/customer/tab/addresses.phtml b/app/design/adminhtml/default/default/template/customer/tab/addresses.phtml
index 0ec2beec71..875075a588 100644
--- a/app/design/adminhtml/default/default/template/customer/tab/addresses.phtml
+++ b/app/design/adminhtml/default/default/template/customer/tab/addresses.phtml
@@ -145,6 +145,7 @@ addressesModel.prototype = {
this.loader = new varienLoader(true);
this.regionsUrl = 'getRegionsUrl() ?>';
+ this.zipOptionalCountries = getCountriesWithOptionalZipJson() ?>;
this.reloadItemList(1);
@@ -184,6 +185,10 @@ addressesModel.prototype = {
Element.hide($('form_'+item.id));
$('form_'+item.id).statusBar = item;
$('form_'+item.id).addressItem = item;
+
+ // set Zip optional/required
+ var countryElement = $('id' + item.id.replace(/address_item_/, '') + 'country_id');
+ this.setZipOptional(countryElement);
}
},
@@ -448,6 +453,19 @@ addressesModel.prototype = {
var url = this.regionsUrl+'parent/'+countryElement.value;
this.loader.load(url, {}, this.refreshRegionField.bind(this));
}
+ // set Zip optional/required
+ this.setZipOptional(countryElement);
+ }
+ },
+
+ setZipOptional : function (countryElement){
+ var zipElement = $(countryElement.id.replace(/country_id/, 'postcode'))
+ if (zipElement && this.zipOptionalCountries.indexOf(countryElement.value) != -1) {
+ zipElement.removeClassName('required-entry').removeClassName('required-entry');
+ zipElement.up(1).down('label > span.required').hide();
+ } else {
+ zipElement.addClassName('required-entry');
+ zipElement.up(1).down('label > span.required').show();
}
},
diff --git a/app/design/adminhtml/default/default/template/customer/tab/view/sales.phtml b/app/design/adminhtml/default/default/template/customer/tab/view/sales.phtml
index 6c698f4908..9eef45bd94 100644
--- a/app/design/adminhtml/default/default/template/customer/tab/view/sales.phtml
+++ b/app/design/adminhtml/default/default/template/customer/tab/view/sales.phtml
@@ -73,6 +73,10 @@
+
+
+
+
diff --git a/app/design/adminhtml/default/default/template/cybersource/form.phtml b/app/design/adminhtml/default/default/template/cybersource/form.phtml
new file mode 100644
index 0000000000..c69614a1e6
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/cybersource/form.phtml
@@ -0,0 +1,162 @@
+
+ getMethodCode(); ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/cybersource/info.phtml b/app/design/adminhtml/default/default/template/cybersource/info.phtml
new file mode 100644
index 0000000000..09c61b10ff
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/cybersource/info.phtml
@@ -0,0 +1,39 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+
+__('Credit Card Type: %s', $this->getCcTypeName()) ?>
+__('Credit Card Number: xxxx-%s', $this->getInfo()->getCcLast4()) ?>
+__('Expiration Date: %s/%s', $this->getCcExpMonth(), $this->getInfo()->getCcExpYear()) ?>
+getInfo()->getCcSsIssue()): ?>
+__("Switch/Solo/Maestro(UK Domestic) card issue number: %s", $this->getInfo()->getCcSsIssue()) ?>
+
+getInfo()->getCcSsStartYear()): ?>
+__('Switch/Solo/Maestro(UK Domestic) card start Date: %s/%s', $this->getCcStartMonth(), $this->getInfo()->getCcSsStartYear()) ?>
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/cybersource/pdf/info.phtml b/app/design/adminhtml/default/default/template/cybersource/pdf/info.phtml
new file mode 100644
index 0000000000..44edabee01
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/cybersource/pdf/info.phtml
@@ -0,0 +1,45 @@
+
+getInfo()): ?>
+ getMethod()->getTitle() ?>
+ {{pdf_row_separator}}
+ __('Name on the Card: %s', $this->getInfo()->getCcOwner()) ?>
+ {{pdf_row_separator}}
+ __('Credit Card Type: %s', $this->getCcTypeName()) ?>
+ {{pdf_row_separator}}
+ __('Credit Card Number: xxxx-%s', $this->getInfo()->getCcLast4()) ?>
+ {{pdf_row_separator}}
+ __('Expiration Date: %s/%s', $this->getCcExpMonth(), $this->getInfo()->getCcExpYear()) ?>
+ {{pdf_row_separator}}
+ getInfo()->getCcSsIssue()): ?>
+ __("Switch/Solo card issue number: %s", $this->getInfo()->getCcSsIssue()) ?>
+ {{pdf_row_separator}}
+
+ getInfo()->getCcSsStartYear()): ?>
+ __('Switch/Solo card start Date: %s/%s', $this->getCcStartMonth(), $this->getInfo()->getCcSsStartYear()) ?>
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/downloadable/product/edit/downloadable/links.phtml b/app/design/adminhtml/default/default/template/downloadable/product/edit/downloadable/links.phtml
index 0a8ba29df6..b0f684f7ac 100644
--- a/app/design/adminhtml/default/default/template/downloadable/product/edit/downloadable/links.phtml
+++ b/app/design/adminhtml/default/default/template/downloadable/product/edit/downloadable/links.phtml
@@ -111,7 +111,7 @@ var linkTemplate = ''+
''+
''+
' '+
- '[getBaseCurrencyCode() ?>] '+
+ '[getStore($_product->getStoreId())->getBaseCurrencyCode() ?>] '+
'getStoreId() && $this->getIsPriceWebsiteScope()?' Use Default Value ':'' ?>'+
' '+
' '+
diff --git a/app/design/adminhtml/default/default/template/eway/form.phtml b/app/design/adminhtml/default/default/template/eway/form.phtml
new file mode 100644
index 0000000000..a65ee369d7
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/eway/form.phtml
@@ -0,0 +1,82 @@
+
+getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/eway/info.phtml b/app/design/adminhtml/default/default/template/eway/info.phtml
new file mode 100644
index 0000000000..4ff2c2ba2c
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/eway/info.phtml
@@ -0,0 +1,30 @@
+
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/adminhtml/default/default/template/eway/pdf/info.phtml b/app/design/adminhtml/default/default/template/eway/pdf/info.phtml
new file mode 100644
index 0000000000..f7e0ef20fd
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/eway/pdf/info.phtml
@@ -0,0 +1,33 @@
+
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+ {{pdf_row_separator}}
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+ {{pdf_row_separator}}
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+ {{pdf_row_separator}}
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/adminhtml/default/default/template/flo2cash/form.phtml b/app/design/adminhtml/default/default/template/flo2cash/form.phtml
new file mode 100644
index 0000000000..2ea7c19fc0
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/flo2cash/form.phtml
@@ -0,0 +1,82 @@
+
+getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/flo2cash/info.phtml b/app/design/adminhtml/default/default/template/flo2cash/info.phtml
new file mode 100644
index 0000000000..49ba65aaa1
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/flo2cash/info.phtml
@@ -0,0 +1,31 @@
+
+getMethod()->getTitle() ?>
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/adminhtml/default/default/template/flo2cash/pdf/info.phtml b/app/design/adminhtml/default/default/template/flo2cash/pdf/info.phtml
new file mode 100644
index 0000000000..fa6327033a
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/flo2cash/pdf/info.phtml
@@ -0,0 +1,35 @@
+
+getMethod()->getTitle() ?>
+ {{pdf_row_separator}}
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+ {{pdf_row_separator}}
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+ {{pdf_row_separator}}
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+ {{pdf_row_separator}}
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/adminhtml/default/default/template/ideal/advanced/info.phtml b/app/design/adminhtml/default/default/template/ideal/advanced/info.phtml
new file mode 100644
index 0000000000..a6e2717190
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/ideal/advanced/info.phtml
@@ -0,0 +1,33 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+
+__('Issuer: %s', $this->getIssuerTitle()) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/ideal/advanced/pdf/info.phtml b/app/design/adminhtml/default/default/template/ideal/advanced/pdf/info.phtml
new file mode 100644
index 0000000000..3b6f17e4ab
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/ideal/advanced/pdf/info.phtml
@@ -0,0 +1,29 @@
+
+getMethod()->getTitle() ?>
+ {{pdf_row_separator}}
+__('Ideal: %s', $this->htmlEscape($this->getInfo()->getIdealIssuerTitle())) ?>
diff --git a/app/design/adminhtml/default/default/template/oscommerce/convert/run.phtml b/app/design/adminhtml/default/default/template/oscommerce/convert/run.phtml
new file mode 100755
index 0000000000..08c4101cef
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/oscommerce/convert/run.phtml
@@ -0,0 +1,252 @@
+
+
+
+
+
+
+
+
+ __('Importing...') ?>
+
+
+
+
+
+
+
+
+
+ __('Data has been successfully imported') ?>
+
+
+
+
+
+
+getCheckButtonHtml() ?>
+getSaveButtonHtml() ?>
+
+
+
diff --git a/app/design/adminhtml/default/default/template/oscommerce/order/view.phtml b/app/design/adminhtml/default/default/template/oscommerce/order/view.phtml
new file mode 100644
index 0000000000..cc014d1845
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/oscommerce/order/view.phtml
@@ -0,0 +1,241 @@
+
+getOrder();
+$_products = $_order->getProducts();
+$_totals = $_order->getTotal();
+$_comments = $_order->getComments();
+$currency = $_order->getCurrencySymbol()?$_order->getCurrencySymbol():$_order->getCurrency();
+?>
+
+
+
+
+
+ __('Order # %s', $_order->getOrdersId()) ?>
+
+
+
+
+
+
+
+
+
+
+
__('Account Information') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
__('Billing Address') ?>
+
+
+ getBillingName() ?>
+
+ getBillingStreetAddress() ?>
+ getBillingCity() ?>, getBillingState() ?> getBillingPostcode() ?>
+ getBillingCountry() ?>
+
+
+
+
+
+
+
+
+
+
__('Delivery Address') ?>
+
+
+ getDeliveryName() ?>
+
+ getDeliveryStreetAddress() ?>
+ getDeliveryCity() ?>, getDeliveryState() ?> getDeliveryPostcode() ?>
+ getDeliveryCountry() ?>
+
+
+
+
+
+
+
+
+
+
+
__('Payment Information') ?>
+
+
+ getPaymentMethod(); ?>
+
+
+
+
+
+
+
+
__('Shipping & Handling Information') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__('Items Ordered') ?>
+
+
+
+
+
+
+
+ __('Product') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty') ?>
+ __('Final Price') ?>
+
+
+
+
+ $_product) :?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__('Comments History') ?>
+
+
+
+
+
+
+
+ formatDate($_comment['date_added'], 'medium', true)?>
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__('Order Totals') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/adminhtml/default/default/template/page/footer.phtml b/app/design/adminhtml/default/default/template/page/footer.phtml
index 9387609340..a8c308f6f2 100644
--- a/app/design/adminhtml/default/default/template/page/footer.phtml
+++ b/app/design/adminhtml/default/default/template/page/footer.phtml
@@ -25,7 +25,7 @@
*/
?>
-
+
__('Interface Locale: %s', $this->getLanguageSelect()) ?>
diff --git a/app/design/adminhtml/default/default/template/paybox/adminhtml/cart/type/select.phtml b/app/design/adminhtml/default/default/template/paybox/adminhtml/cart/type/select.phtml
new file mode 100644
index 0000000000..2b4f54da5c
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/paybox/adminhtml/cart/type/select.phtml
@@ -0,0 +1,45 @@
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/paybox/direct/form.phtml b/app/design/adminhtml/default/default/template/paybox/direct/form.phtml
new file mode 100644
index 0000000000..40267361ae
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/paybox/direct/form.phtml
@@ -0,0 +1,82 @@
+
+getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/paybox/direct/info.phtml b/app/design/adminhtml/default/default/template/paybox/direct/info.phtml
new file mode 100644
index 0000000000..5821cf959a
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/paybox/direct/info.phtml
@@ -0,0 +1,31 @@
+
+htmlEscape($this->getMethod()->getTitle()) ?>
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/adminhtml/default/default/template/paybox/direct/pdf/info.phtml b/app/design/adminhtml/default/default/template/paybox/direct/pdf/info.phtml
new file mode 100644
index 0000000000..682b848c2f
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/paybox/direct/pdf/info.phtml
@@ -0,0 +1,35 @@
+
+htmlEscape($this->getMethod()->getTitle()) ?>
+ {{pdf_row_separator}}
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+ {{pdf_row_separator}}
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+ {{pdf_row_separator}}
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+ {{pdf_row_separator}}
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/adminhtml/default/default/template/report/grid.phtml b/app/design/adminhtml/default/default/template/report/grid.phtml
index fbee31d497..0148f2cea9 100644
--- a/app/design/adminhtml/default/default/template/report/grid.phtml
+++ b/app/design/adminhtml/default/default/template/report/grid.phtml
@@ -206,6 +206,29 @@ $numColumns = sizeof($this->getColumns());
}
}
+ /* Overwrite function from switcher.phtml widget*/
+ function switchStore(obj){
+ if (obj.options[obj.selectedIndex].getAttribute('website') == 'true') {
+ var selectionType = 'website';
+ } else if (obj.options[obj.selectedIndex].getAttribute('group') == 'true') {
+ var selectionType = 'group';
+ } else {
+ var selectionType = 'store';
+ }
+ var storeParam = obj.value ? selectionType + '/' + obj.value + '/' : '';
+ if(obj.switchParams){
+ storeParam+= obj.switchParams;
+ }
+ var formParam = new Array('period_date_from', 'period_date_to', 'report_period');
+ var paramURL = '';
+ var switchURL = 'getGridUrl(); ?>'.replace(/(store|group|website)\/\d+\//,'');
+ for(var i=0;i
diff --git a/app/design/adminhtml/default/default/template/sales/order/create/items/grid.phtml b/app/design/adminhtml/default/default/template/sales/order/create/items/grid.phtml
index b0fa6a13c7..a9d54a7121 100644
--- a/app/design/adminhtml/default/default/template/sales/order/create/items/grid.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/create/items/grid.phtml
@@ -74,7 +74,7 @@
helper('sales')->__('Total %d product(s)', count($_items)) ?>
helper('sales')->__('Subtotal:') ?>
formatPrice($this->getSubtotal()) ?>
- formatPrice(-$this->getDiscountAmount()) ?>
+ formatPrice($this->getDiscountAmount()) ?>
formatPrice($this->getSubtotalWithDiscount()) ?>
isGiftMessagesAvailable()): ?>colspan="2">
@@ -293,13 +293,14 @@
helper('tax')->displayCartPriceExclTax($this->getStore()) || $this->helper('tax')->displayCartBothPrices($this->getStore())): ?>
+ getRowTotal() - $_item->getDiscountAmount();?>
helper('tax')->displayCartBothPrices($this->getStore())): ?>
__('Excl. Tax'); ?>:
typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
- formatPrice($_item->getRowTotalWithDiscount()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+ formatPrice($_rowTotalWithoutDiscount+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
- formatPrice($_item->getRowTotalWithDiscount()) ?>
+ formatPrice($_rowTotalWithoutDiscount) ?>
@@ -335,12 +336,12 @@
helper('tax')->displayCartBothPrices($this->getStore())): ?>
__('Incl. Tax'); ?>:
- getRowTotalWithDiscount()+$_item->getTaxAmount(); ?>
- typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
- formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
-
- formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
-
+ getRowTotal()-$_item->getDiscountAmount()+$_item->getTaxAmount(); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
getApplied($_item)): ?>
typeOfDisplay($_item, 1, 'sales')): ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/create/totals.phtml b/app/design/adminhtml/default/default/template/sales/order/create/totals.phtml
index c851ee3a7e..6c04c2005c 100644
--- a/app/design/adminhtml/default/default/template/sales/order/create/totals.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/create/totals.phtml
@@ -24,11 +24,10 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
-
- getStore() ?>
renderTotals(); ?>
+ renderTotals('footer'); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/create/totals/default.phtml b/app/design/adminhtml/default/default/template/sales/order/create/totals/default.phtml
index 1ca47f96b6..b1f2362b5b 100644
--- a/app/design/adminhtml/default/default/template/sales/order/create/totals/default.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/create/totals/default.phtml
@@ -1,3 +1,29 @@
+
getRenderingArea() == $this->getTotal()->getArea()): ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/create/totals/grandtotal.phtml b/app/design/adminhtml/default/default/template/sales/order/create/totals/grandtotal.phtml
new file mode 100644
index 0000000000..c8a207df20
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/sales/order/create/totals/grandtotal.phtml
@@ -0,0 +1,58 @@
+
+includeTax() && $this->getTotalExclTax()>=0):?>
+
+
+ helper('tax')->__('Grand Total Excl. Tax')?>
+
+
+ helper('checkout')->formatPrice($this->getTotalExclTax()) ?>
+
+
+renderTotals('taxes', $this->getColspan()); ?>
+
+
+ helper('tax')->__('Grand Total Incl. Tax')?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
+
+
+
+
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/sales/order/create/totals/shipping.phtml b/app/design/adminhtml/default/default/template/sales/order/create/totals/shipping.phtml
new file mode 100644
index 0000000000..ea4a273cfb
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/sales/order/create/totals/shipping.phtml
@@ -0,0 +1,66 @@
+
+displayBoth()):?>
+
+
+ getExcludeTaxLabel() ?>
+
+
+ helper('checkout')->formatPrice($this->getShippingExcludeTax()) ?>
+
+
+
+
+ getIncludeTaxLabel() ?>
+
+
+ helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
+
+
+displayIncludeTax()) : ?>
+
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
+
+
+
+
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($this->getShippingExcludeTax()) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/sales/order/create/totals/subtotal.phtml b/app/design/adminhtml/default/default/template/sales/order/create/totals/subtotal.phtml
new file mode 100644
index 0000000000..d4a9b8497d
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/sales/order/create/totals/subtotal.phtml
@@ -0,0 +1,57 @@
+
+displayBoth()):?>
+
+
+ helper('tax')->__('Subtotal (Excl. Tax)') ?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValueExclTax()) ?>
+
+
+
+
+ helper('tax')->__('Subtotal (Incl. Tax)') ?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValueInclTax()) ?>
+
+
+
+
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/sales/order/create/totals/tax.phtml b/app/design/adminhtml/default/default/template/sales/order/create/totals/tax.phtml
index 3eca80fcaa..2d099d3f31 100644
--- a/app/design/adminhtml/default/default/template/sales/order/create/totals/tax.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/create/totals/tax.phtml
@@ -1,3 +1,29 @@
+
helper('tax')->displayFullSummary()): ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items.phtml b/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items.phtml
index 5cb20c0892..95dc28276a 100644
--- a/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items.phtml
@@ -96,7 +96,7 @@
__('Refund Totals') ?>
- getChildHtml('order_totals') ?>
+ getChildHtml('creditmemo_totals') ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/configurable.phtml b/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/configurable.phtml
index d41d7f0d31..018d4718cf 100644
--- a/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/configurable.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/configurable.phtml
@@ -29,9 +29,9 @@
getColumnHtml($_item, 'configurable_name') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -82,9 +82,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -140,9 +140,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -192,9 +192,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/default.phtml b/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/default.phtml
index 305b2a2ee2..77e6e79af0 100644
--- a/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/default.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/items/renderer/default.phtml
@@ -29,9 +29,9 @@
getColumnHtml($_item, 'name') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -82,9 +82,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -140,9 +140,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -192,9 +192,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/totals/adjustments.phtml b/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/totals/adjustments.phtml
index 5090bab2d8..7e46f17a63 100644
--- a/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/totals/adjustments.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/creditmemo/create/totals/adjustments.phtml
@@ -25,8 +25,6 @@
*/
?>
getSource() ?>
-setPriceDataObject($_source) ?>
-getCurrency() ?>
helper('sales')->__('Refund Shipping') ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/form.phtml b/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/form.phtml
index 2535fbd95a..a963ab9c24 100644
--- a/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/form.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/form.phtml
@@ -92,6 +92,6 @@
__('Credit Memo Totals') ?>
-
getChildHtml('order_totals') ?>
+
getChildHtml('creditmemo_totals') ?>
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/configurable.phtml b/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/configurable.phtml
index 62008c4e59..26a2b03a93 100644
--- a/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/configurable.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/configurable.phtml
@@ -29,9 +29,9 @@
getColumnHtml($_item, 'configurable_name') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -82,9 +82,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -127,9 +127,9 @@
getQty()*1 ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -179,9 +179,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/default.phtml b/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/default.phtml
index 62fa9682b0..d0437f10ed 100644
--- a/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/default.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/default.phtml
@@ -29,9 +29,9 @@
getColumnHtml($_item, 'name') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -82,9 +82,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -127,9 +127,9 @@
getQty()*1 ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -179,9 +179,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/invoice/create/items.phtml b/app/design/adminhtml/default/default/template/sales/order/invoice/create/items.phtml
index df3da9c582..20ea53c905 100644
--- a/app/design/adminhtml/default/default/template/sales/order/invoice/create/items.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/invoice/create/items.phtml
@@ -87,7 +87,7 @@
__('Invoice Totals') ?>
- getChildHtml('order_totals') ?>
+ getChildHtml('invoice_totals') ?>
canCapture()): ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/invoice/create/items/renderer/configurable.phtml b/app/design/adminhtml/default/default/template/sales/order/invoice/create/items/renderer/configurable.phtml
index c0eee5c57e..f2dcb3b733 100644
--- a/app/design/adminhtml/default/default/template/sales/order/invoice/create/items/renderer/configurable.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/invoice/create/items/renderer/configurable.phtml
@@ -29,9 +29,9 @@
getColumnHtml($_item, 'configurable_name') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -82,9 +82,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -134,9 +134,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -186,9 +186,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/invoice/create/items/renderer/default.phtml b/app/design/adminhtml/default/default/template/sales/order/invoice/create/items/renderer/default.phtml
index ce7169dbba..7590e96da0 100644
--- a/app/design/adminhtml/default/default/template/sales/order/invoice/create/items/renderer/default.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/invoice/create/items/renderer/default.phtml
@@ -29,9 +29,9 @@
getColumnHtml($_item, 'name') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -82,9 +82,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -134,9 +134,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -186,9 +186,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/invoice/view/form.phtml b/app/design/adminhtml/default/default/template/sales/order/invoice/view/form.phtml
index 701fed4268..c1de538372 100644
--- a/app/design/adminhtml/default/default/template/sales/order/invoice/view/form.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/invoice/view/form.phtml
@@ -88,6 +88,6 @@
__('Invoice Totals') ?>
-
getChildHtml('order_totals') ?>
+
getChildHtml('invoice_totals') ?>
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/configurable.phtml b/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/configurable.phtml
index a50773b564..730aa38ade 100644
--- a/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/configurable.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/configurable.phtml
@@ -29,9 +29,9 @@
getColumnHtml($_item, 'configurable_name') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -82,9 +82,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -134,9 +134,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -186,9 +186,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/default.phtml b/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/default.phtml
index 0776413e69..78b6b86c60 100644
--- a/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/default.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/invoice/view/items/renderer/default.phtml
@@ -29,9 +29,9 @@
getColumnHtml($_item, 'name') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -82,9 +82,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -127,9 +127,9 @@
getQty()*1 ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -179,9 +179,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/sales/order/totals.phtml b/app/design/adminhtml/default/default/template/sales/order/totals.phtml
index 026a9e8c92..80fb935b97 100644
--- a/app/design/adminhtml/default/default/template/sales/order/totals.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/totals.phtml
@@ -24,11 +24,61 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
-getSource(); ?>
+getSource(); ?>
setPriceDataObject($_source) ?>
getChildHtml('main'); ?>
getChildHtml('footer'); ?>
-
\ No newline at end of file
+
+
+ getTotals('')?>
+
+
+ $_total): ?>
+ getBlockName()): ?>
+ getChildHtml($_total->getBlockName(), false); ?>
+
+
+ getLabelProperties()?> class="label">
+ getStrong()):?>
+ getLabel()?>
+
+ getLabel()?>
+
+
+ getStrong()):?>
+ getValueProperties()?> class="emph">
+ formatValue($_total) ?>
+
+ getValueProperties()?>>
+ formatValue($_total) ?>
+
+
+
+
+
+
+
+
+ getTotals('footer')?>
+
+
+ getTotals('footer') as $_code => $_total): ?>
+ getBlockName()): ?>
+ getChildHtml($_total->getBlockName(), false); ?>
+
+
+ getLabelProperties()?> class="label">
+ getLabel()?>
+
+ getValueProperties()?> class="emph">
+ formatValue($_total) ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/adminhtml/default/default/template/sales/order/totals/subtotal.phtml b/app/design/adminhtml/default/default/template/sales/order/totals/subtotal.phtml
new file mode 100644
index 0000000000..d538fd8ece
--- /dev/null
+++ b/app/design/adminhtml/default/default/template/sales/order/totals/subtotal.phtml
@@ -0,0 +1,59 @@
+
+getSource();
+ $_order = $this->getOrder();
+ $this->setPriceDataObject($_source);
+?>
+helper('tax')->displaySalesSubtotalBoth($_order->getStore())): ?>
+
+
+ __('Subtotal (Excl. Tax)')?>
+
+ displaySubtotalExclTax() ?>
+
+
+
+ __('Subtotal (Incl. Tax)')?>
+
+ displaySubtotalInclTax() ?>
+
+helper('tax')->displaySalesSubtotalInclTax($_order->getStore())):?>
+
+
+ __('Subtotal') ?>
+
+ displaySubtotalInclTax() ?>
+
+
+
+
+ __('Subtotal') ?>
+
+ displaySubtotalExclTax() ?>
+
+
diff --git a/app/design/adminhtml/default/default/template/sales/order/totals/tax.phtml b/app/design/adminhtml/default/default/template/sales/order/totals/tax.phtml
index b9ac9c915c..a942590261 100644
--- a/app/design/adminhtml/default/default/template/sales/order/totals/tax.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/totals/tax.phtml
@@ -24,51 +24,57 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
-getSource() ?>
-getOrder() ?>
-setPriceDataObject($_source) ?>
-getCurrency() ?>
-
-getTaxAmount()): ?>
- helper('tax')->displayFullSummary()): ?>
-
- getFullTaxInfo() as $info): ?>
-
-
-
-
-
-
+getSource();
+ $_order = $this->getOrder();
+ $_fullInfo = $this->getFullTaxInfo();
+?>
-
-
-
- (%)
-
-
-
-
- displayAmount($amount, $baseAmount); ?>
-
-
-
-
-
-
-
+displayFullSummary()): ?>
+
+
+
+
- helper('tax')->displayFullSummary()): ?> class="tax-total" onclick="expandDetails(this, '.tax-details')">
-
-
- helper('tax')->displayFullSummary()): ?>
- __('Total Tax') ?>
+
+
+
+ (%)
- __('Tax') ?>
-
-
-
-
- displayAmount($this->getOrder()->getTaxAmount(), $this->getOrder()->getBaseTaxAmount()); ?>
-
-
-
\ No newline at end of file
+
+
+
+ displayAmount($amount, $baseAmount); ?>
+
+
+
+
+
+
+displayFullSummary() && $_fullInfo): ?>
+
+
+
+
+
+
+ helper('tax')->displayFullSummary()): ?>
+ __('Total Tax') ?>
+
+ __('Tax') ?>
+
+
+
+
+ displayAmount($_source->getTaxAmount(), $_source->getBaseTaxAmount()); ?>
+
+
diff --git a/app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml b/app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml
index 96ed37d7c1..45e1c8f405 100644
--- a/app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml
+++ b/app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml
@@ -75,9 +75,9 @@
getStatus() ?>
displayPriceAttribute('original_price') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -128,9 +128,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getPriceInclTax($_item); ?>
@@ -174,9 +174,9 @@
getColumnHtml($_item, 'qty') ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Excl. Tax'); ?>:
@@ -226,9 +226,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/adminhtml/default/default/template/system/convert/profile/wizard.phtml b/app/design/adminhtml/default/default/template/system/convert/profile/wizard.phtml
index faa73764f5..a18ed05c60 100644
--- a/app/design/adminhtml/default/default/template/system/convert/profile/wizard.phtml
+++ b/app/design/adminhtml/default/default/template/system/convert/profile/wizard.phtml
@@ -371,7 +371,10 @@ Event.observe(window, 'load', function(){
__("In Database:") ?>
- getAttributes($_entityType) as $_value=>$_label): ?>
+ getAttributes($_entityType);
+ asort($fieldMappingInDatabase);
+ foreach ($fieldMappingInDatabase as $_value=>$_label): ?>
diff --git a/app/design/frontend/default/blank/layout/amazonpayments.xml b/app/design/frontend/default/blank/layout/amazonpayments.xml
new file mode 100755
index 0000000000..c5062e7701
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/amazonpayments.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/bundle.xml b/app/design/frontend/default/blank/layout/bundle.xml
new file mode 100644
index 0000000000..6fe9f3a5d9
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/bundle.xml
@@ -0,0 +1,297 @@
+
+
+
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+ bundle 4
+
+
+
+
+
+
+
+ bundle bundle/checkout_cart_item_renderer checkout/cart/sidebar/default.phtml
+
+
+
+
+
+ bundle bundle/checkout_cart_item_renderer checkout/cart/sidebar/default.phtml
+
+
+
+
+
+
+
+ bundle bundle/checkout_cart_item_renderer checkout/cart/item/default.phtml
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+
+
+ bundle bundle/checkout_cart_item_renderer checkout/onepage/review/item.phtml
+
+
+
+
+
+ bundle bundle/checkout_cart_item_renderer checkout/multishipping/item/default.phtml
+
+
+
+
+
+ bundle bundle/checkout_cart_item_renderer checkout/multishipping/item/default.phtml
+
+
+ bundle bundle/checkout_cart_item_renderer checkout/multishipping/item/default.phtml
+
+
+
+
+
+ bundle bundle/checkout_cart_item_renderer checkout/multishipping/item/default.phtml
+
+
+
+
+
+
+
+ skin_js js/bundle.js
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/price.phtml
+
+
+
+
+
+ select bundle/catalog_product_view_type_bundle_option_select
+ multi bundle/catalog_product_view_type_bundle_option_multi
+ radio bundle/catalog_product_view_type_bundle_option_radio
+ checkbox bundle/catalog_product_view_type_bundle_option_checkbox
+
+ product.info.bundle.options
+
+
+
+
+
+
+ bundle bundle/catalog_product_price bundle/catalog/product/view/price.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/sales/order/items/renderer.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/sales/order/invoice/items/renderer.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/sales/order/shipment/items/renderer.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/sales/order/creditmemo/items/renderer.phtml
+
+
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/sales/order/items/renderer.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/sales/order/invoice/items/renderer.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/sales/order/shipment/items/renderer.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/sales/order/creditmemo/items/renderer.phtml
+
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/email/order/items/order/default.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/email/order/items/invoice/default.phtml
+
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/email/order/items/shipment/default.phtml
+
+
+
+
+
+ bundle bundle/sales_order_items_renderer bundle/email/order/items/creditmemo/default.phtml
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/catalog.xml b/app/design/frontend/default/blank/layout/catalog.xml
new file mode 100644
index 0000000000..96cadb0687
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/catalog.xml
@@ -0,0 +1,375 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ images/media/col_left_callout.jpg
+ Our customer service is available 24/7. Call us at (555) 555-0123.
+ checkout/cart
+
+
+
+
+
+
+
+ Site Map Site Map
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ product_list_toolbar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ product_list_toolbar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/popup.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+ catalog_compare_sidebar
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+ js_css calendar/calendar-win2k-1.css
+ js calendar/calendar.js
+ js calendar/calendar-setup.js
+
+
+
+
+
+
+
+
+ 4
+ upsell 4
+
+
+
+
+
+
+
+
+
+
+
+ text catalog/product_view_options_type_text catalog/product/view/options/type/text.phtml
+ file catalog/product_view_options_type_file catalog/product/view/options/type/file.phtml
+ select catalog/product_view_options_type_select catalog/product/view/options/type/select.phtml
+ date catalog/product_view_options_type_date catalog/product/view/options/type/date.phtml
+
+
+
+
+ product.tierprices
+
+ product.info.addtocart
+
+
+
+ alias_in_layout container1
+ options_container product
+ product.info.options.wrapper
+ product.info.options.wrapper.bottom
+
+
+ alias_in_layout container2
+ options_container product
+ product.info.options.wrapper
+ product.info.options.wrapper.bottom
+
+ container1 ifEquals 0 alias_in_layout options_container
+ container2 ifEquals 0 alias_in_layout options_container
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/popup.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Categories
+
+ seo.sitemap.pager.top
+ seo.sitemap.pager.bottom
+ categories
+
+
+
+ Products Sitemap Products Sitemap
+
+
+
+
+
+
+
+
+
+
+
+ seo.sitemap.tree.pager.top
+ seo.sitemap.tree.pager.bottom
+
+
+
+
+
+
+
+ Products
+
+ seo.sitemap.pager.top
+ seo.sitemap.pager.bottom
+ products
+
+
+
+ Categories Sitemap Categories Sitemap
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/catalogsearch.xml b/app/design/frontend/default/blank/layout/catalogsearch.xml
new file mode 100644
index 0000000000..b987720adf
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/catalogsearch.xml
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+ Search Terms Search Terms
+ Advanced Search Advanced Search
+
+
+
+
+
+
+
+ page/3columns.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+ js_css calendar/calendar-win2k-1.css
+ js calendar/calendar.js
+ js calendar/calendar-setup.js
+
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/checkout.xml b/app/design/frontend/default/blank/layout/checkout.xml
new file mode 100644
index 0000000000..e2075b77bb
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/checkout.xml
@@ -0,0 +1,379 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ simple checkout/cart_item_renderer checkout/cart/sidebar/default.phtml
+ grouped checkout/cart_item_renderer_grouped checkout/cart/sidebar/default.phtml
+ configurable checkout/cart_item_renderer_configurable checkout/cart/sidebar/default.phtml
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+ checkout/cart.phtml
+ checkout/cart/noItems.phtml
+
+ simple checkout/cart_item_renderer checkout/cart/item/default.phtml
+ grouped checkout/cart_item_renderer_grouped checkout/cart/item/default.phtml
+ configurable checkout/cart_item_renderer_configurable checkout/cart/item/default.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ default checkout/cart_item_renderer checkout/multishipping/item/default.phtml
+ grouped checkout/cart_item_renderer_grouped checkout/multishipping/item/default.phtml
+ configurable checkout/cart_item_renderer_configurable checkout/multishipping/item/default.phtml
+
+
+
+
+
+
+
+
+
+
+
+ default checkout/cart_item_renderer checkout/multishipping/item/default.phtml
+ grouped checkout/cart_item_renderer_grouped checkout/multishipping/item/default.phtml
+ configurable checkout/cart_item_renderer_configurable checkout/multishipping/item/default.phtml
+
+
+ default checkout/cart_item_renderer checkout/multishipping/item/default.phtml
+ grouped checkout/cart_item_renderer_grouped checkout/multishipping/item/default.phtml
+ configurable checkout/cart_item_renderer_configurable checkout/multishipping/item/default.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+ purchaseorder payment/form/purchaseorder.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ default checkout/cart_item_renderer checkout/multishipping/item/default.phtml
+ grouped checkout/cart_item_renderer_grouped checkout/multishipping/item/default.phtml
+ configurable checkout/cart_item_renderer_configurable checkout/multishipping/item/default.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ purchaseorder payment/form/purchaseorder.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ purchaseorder payment/form/purchaseorder.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ default checkout/cart_item_renderer checkout/onepage/review/item.phtml
+ grouped checkout/cart_item_renderer_grouped checkout/onepage/review/item.phtml
+ configurable checkout/cart_item_renderer_configurable checkout/onepage/review/item.phtml
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/chronopay.xml b/app/design/frontend/default/blank/layout/chronopay.xml
new file mode 100644
index 0000000000..cd0df88a88
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/chronopay.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/cms.xml b/app/design/frontend/default/blank/layout/cms.xml
new file mode 100644
index 0000000000..6e685ac6c5
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/cms.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ footer_links
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/contacts.xml b/app/design/frontend/default/blank/layout/contacts.xml
new file mode 100644
index 0000000000..123d61e442
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/contacts.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+ Contact Us contacts Contact Us true
+
+
+
+
+
+ page/2columns-right.phtml
+ Contact Us
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/core.xml b/app/design/frontend/default/blank/layout/core.xml
new file mode 100644
index 0000000000..b95175fde6
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/core.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/customer.xml b/app/design/frontend/default/blank/layout/customer.xml
new file mode 100644
index 0000000000..3d2db79f1b
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/customer.xml
@@ -0,0 +1,247 @@
+
+
+
+
+
+
+
+
+
+
+ My Account My Account 10
+
+
+
+
+
+
+
+ Log Out Log Out 100
+
+
+
+
+
+
+
+ Log In Log In 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+ Password forgotten
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+ Send confirmation link
+
+
+
+
+
+
+
+
+
+ Edit Account Info
+
+
+
+
+
+
+ left.permanent.callout
+
+
+
+
+
+
+
+
+ page/2columns-left.phtml
+
+
+
+
+ account customer/account/ Account Dashboard
+ account_edit customer/account/edit/ Account Information
+ address_book customer/address/ Address Book
+
+
+ simple checkout/cart_item_renderer checkout/cart/sidebar/default.phtml
+ grouped checkout/cart_item_renderer_grouped checkout/cart/sidebar/default.phtml
+ configurable checkout/cart_item_renderer_configurable checkout/cart/sidebar/default.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-left.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/cybermut.xml b/app/design/frontend/default/blank/layout/cybermut.xml
new file mode 100644
index 0000000000..4ff5d146d2
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/cybermut.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/directory.xml b/app/design/frontend/default/blank/layout/directory.xml
new file mode 100644
index 0000000000..4210536c16
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/directory.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/downloadable.xml b/app/design/frontend/default/blank/layout/downloadable.xml
new file mode 100644
index 0000000000..8d3563923c
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/downloadable.xml
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+ downloadable_products downloadable/customer/products My Downloadable Products
+
+
+
+
+
+
+
+
+
+ My Downloadable Products
+
+
+
+
+
+ downloadable downloadable/checkout_cart_item_renderer downloadable/checkout/cart/item/default.phtml
+
+
+
+
+
+ downloadable downloadable/checkout_cart_item_renderer downloadable/checkout/onepage/review/item.phtml
+
+
+
+
+
+
+
+
+
+
+
+ downloadable downloadable/checkout_cart_item_renderer downloadable/checkout/multishipping/item/downloadable.phtml
+
+
+
+
+
+ downloadable downloadable/checkout_cart_item_renderer downloadable/checkout/multishipping/item/downloadable.phtml
+
+
+
+
+
+ downloadable downloadable/checkout_cart_item_renderer downloadable/checkout/multishipping/item/downloadable.phtml
+
+
+
+
+
+
+
+
+
+
+
+ downloadable downloadable/sales_order_item_renderer_downloadable downloadable/sales/order/items/renderer/downloadable.phtml
+
+
+
+
+
+ downloadable downloadable/sales_order_item_renderer_downloadable downloadable/sales/order/invoice/items/renderer/downloadable.phtml
+
+
+
+
+
+ downloadable downloadable/sales_order_item_renderer_downloadable downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml
+
+
+
+
+
+
+
+ downloadable downloadable/sales_order_item_renderer_downloadable downloadable/sales/order/items/renderer/downloadable.phtml
+
+
+
+
+
+ downloadable downloadable/sales_order_item_renderer_downloadable downloadable/sales/order/invoice/items/renderer/downloadable.phtml
+
+
+
+
+
+ downloadable downloadable/sales_order_item_renderer_downloadable downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml
+
+
+
+
+
+
+
+
+
+ downloadable downloadable/sales_order_email_items_order_downloadable downloadable/email/order/items/order/downloadable.phtml
+
+
+
+
+
+ downloadable downloadable/sales_order_email_items_downloadable downloadable/email/order/items/invoice/downloadable.phtml
+
+
+
+
+
+ downloadable downloadable/sales_order_email_items_downloadable downloadable/email/order/items/creditmemo/downloadable.phtml
+
+
+
+
+
+
+
+
+
+
+
+ product.info.downloadable.options
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/eway.xml b/app/design/frontend/default/blank/layout/eway.xml
new file mode 100644
index 0000000000..1b8ddc9651
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/eway.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/giftmessage.xml b/app/design/frontend/default/blank/layout/giftmessage.xml
new file mode 100644
index 0000000000..ff81a066b0
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/giftmessage.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+ page/popup.phtml
+
+
+
+
+
+
+
+
+
+ page/popup.phtml
+
+
+
+ save
+
+
+
+
+
+
+
+ page/popup.phtml
+
+
+
+ remove
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/googleanalytics.xml b/app/design/frontend/default/blank/layout/googleanalytics.xml
new file mode 100644
index 0000000000..edb53a230c
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/googleanalytics.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/googlecheckout.xml b/app/design/frontend/default/blank/layout/googlecheckout.xml
new file mode 100644
index 0000000000..ff7ddaba9d
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/googlecheckout.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/googleoptimizer.xml b/app/design/frontend/default/blank/layout/googleoptimizer.xml
new file mode 100644
index 0000000000..a61fc6e1cd
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/googleoptimizer.xml
@@ -0,0 +1,153 @@
+
+
+
+
+
+
+
+
+
+ control_script
+
+
+
+
+ tracking_script
+
+
+
+
+
+
+
+ control_script
+
+
+
+
+ tracking_script
+
+
+
+
+
+
+
+ control_script
+
+
+
+
+ tracking_script
+
+
+
+
+
+
+
+ control_script
+
+
+
+
+ tracking_script
+
+
+
+
+
+
+
+ control_script
+
+
+
+
+ tracking_script
+
+
+
+
+
+
+
+ conversion_script
+ checkout_cart
+
+
+
+
+
+
+
+ conversion_script
+ checkout_onepage
+
+
+
+
+
+
+
+ conversion_script
+ checkout_onepage_success
+
+
+
+
+
+
+
+ conversion_script
+ checkout_multishipping_success
+
+
+
+
+
+
+
+ conversion_script
+ checkout_multishipping
+
+
+
+
+
+
+
+ conversion_script
+ customer_account_create
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/ideal.xml b/app/design/frontend/default/blank/layout/ideal.xml
new file mode 100644
index 0000000000..30caf0fdd8
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/ideal.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/newsletter.xml b/app/design/frontend/default/blank/layout/newsletter.xml
new file mode 100644
index 0000000000..5e20d6ed59
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/newsletter.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ newsletter newsletter/manage/ Newsletter Subscriptions
+
+
+
+
+
+
+ right.newsletter
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/oscommerce.xml b/app/design/frontend/default/blank/layout/oscommerce.xml
new file mode 100644
index 0000000000..d6c695dcb4
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/oscommerce.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/page.xml b/app/design/frontend/default/blank/layout/page.xml
new file mode 100644
index 0000000000..d88547ce00
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/page.xml
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ css/reset.css
+ css/styles.css
+ css/clears.css
+
+ skin_css css/styles-ie.css lt IE 8
+
+ js lib/ds-sleight.js lt IE 7
+ js varien/iehover-fix.js lt IE 7
+
+ css/print.css media="print"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ css/reset.css
+ css/styles.css
+ css/clears.css
+
+ skin_css css/styles-ie.css lt IE 8
+
+ js lib/ds-sleight.js lt IE 7
+ js varien/iehover-fix.js lt IE 7
+
+ css/print.css media="print"
+
+
+
+
+
+
+
+
+
+
+ page/one-column.phtml
+
+ 1
+
+
+
+
+
+ page/1column.phtml
+
+ 1
+
+
+
+
+
+ page/2columns-left.phtml
+
+ 1
+
+
+
+
+
+ page/2columns-right.phtml
+
+ 1
+
+
+
+
+
+ page/3columns.phtml
+
+ 1
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/paybox.xml b/app/design/frontend/default/blank/layout/paybox.xml
new file mode 100644
index 0000000000..f0076f1603
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/paybox.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/paypal.xml b/app/design/frontend/default/blank/layout/paypal.xml
new file mode 100644
index 0000000000..389f399a3c
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/paypal.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/paypaluk.xml b/app/design/frontend/default/blank/layout/paypaluk.xml
new file mode 100644
index 0000000000..23b1e6f360
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/paypaluk.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/1column.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/poll.xml b/app/design/frontend/default/blank/layout/poll.xml
new file mode 100644
index 0000000000..ffb11c3d6b
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/poll.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+ poll/active.phtml poll
+ poll/result.phtml results
+
+
+
+
+
+
+
+
+
+ right.poll
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/productalert.xml b/app/design/frontend/default/blank/layout/productalert.xml
new file mode 100644
index 0000000000..9ece2ec3fb
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/productalert.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/protx.xml b/app/design/frontend/default/blank/layout/protx.xml
new file mode 100644
index 0000000000..fd7d357378
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/protx.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/reports.xml b/app/design/frontend/default/blank/layout/reports.xml
new file mode 100644
index 0000000000..c9a8d60a6a
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/reports.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/review.xml b/app/design/frontend/default/blank/layout/review.xml
new file mode 100644
index 0000000000..3010443c09
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/review.xml
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+ reviews review/customer My Product Reviews
+
+
+
+
+
+
+
+
+
+
+ customer_account_dashboard_info1
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-left.phtml
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/rss.xml b/app/design/frontend/default/blank/layout/rss.xml
new file mode 100644
index 0000000000..05605b61a2
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/rss.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+ RSS rss RSS true class="link-rss"
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/sales.xml b/app/design/frontend/default/blank/layout/sales.xml
new file mode 100644
index 0000000000..ba22d32d13
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/sales.xml
@@ -0,0 +1,267 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ reorder
+
+
+
+
+
+
+ orders sales/order/history/ My Orders
+
+
+
+
+
+
+
+
+
+ top
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ default sales/order_item_renderer_default sales/order/items/renderer/default.phtml
+
+ colspan="4" class="a-right"
+ class="last a-right"
+
+
+
+
+
+
+ view Order Information
+ invoice */*/invoice Invoices
+ shipment */*/shipment Shipments
+ creditmemo */*/creditmemo Refunds
+
+
+
+
+
+
+
+
+
+ default sales/order_item_renderer_default sales/order/invoice/items/renderer/default.phtml
+
+ colspan="4" class="a-right"
+ class="last a-right"
+
+
+
+
+
+
+ view */*/view Order Information
+ invoice Invoices
+ shipment */*/shipment Shipments
+ creditmemo */*/creditmemo Refunds
+
+
+
+
+
+
+
+
+
+ default sales/order_item_renderer_default sales/order/shipment/items/renderer/default.phtml
+
+
+
+
+ view */*/view Order Information
+ invoice */*/invoice Invoices
+ shipment Shipments
+ creditmemo */*/creditmemo Refunds
+
+
+
+
+
+
+
+
+
+ default sales/order_item_renderer_default sales/order/creditmemo/items/renderer/default.phtml
+
+ colspan="6" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+
+
+
+
+
+ view */*/view Order Information
+ invoice */*/invoice Invoices
+ shipment */*/shipment Shipments
+ creditmemo Refunds
+
+
+
+
+
+
+
+
+
+
+
+
+
+ default sales/order_item_renderer_default sales/order/items/renderer/default.phtml
+
+ colspan="4" class="a-right"
+ class="last a-right"
+
+ 1
+
+
+
+
+
+
+
+
+
+ default sales/order_item_renderer_default sales/order/invoice/items/renderer/default.phtml
+
+ colspan="4" class="a-right"
+ class="last a-right"
+
+
+
+
+
+
+
+
+
+ default sales/order_item_renderer_default sales/order/shipment/items/renderer/default.phtml
+
+
+
+
+
+
+
+ default sales/order_item_renderer_default sales/order/creditmemo/items/renderer/default.phtml
+
+ colspan="6" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+
+
+
+
+
+
+
+
+ default sales/order_email_items_order_default email/order/items/order/default.phtml
+
+ colspan="3" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+ 1
+
+
+
+
+
+
+
+ default sales/order_email_items_default email/order/items/invoice/default.phtml
+
+ colspan="3" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+
+
+
+
+
+
+ default sales/order_email_items_default email/order/items/shipment/default.phtml
+
+
+
+
+
+ default sales/order_email_items_default email/order/items/creditmemo/default.phtml
+
+ colspan="3" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/sendfriend.xml b/app/design/frontend/default/blank/layout/sendfriend.xml
new file mode 100644
index 0000000000..012dbc1d1e
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/sendfriend.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/shipping.xml b/app/design/frontend/default/blank/layout/shipping.xml
new file mode 100644
index 0000000000..289628fecc
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/shipping.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/popup.phtml
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/layout/tag.xml b/app/design/frontend/default/blank/layout/tag.xml
new file mode 100644
index 0000000000..0df3a93cb4
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/tag.xml
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tags tag/customer/ My Tags
+
+
+
+
+
+
+
+
+ customer_account_dashboard_info2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ My Account
+
+
+
+
+
+
+
+
+
+ My Account
+
+
+
+
+
+
+
+
+
+ My Account
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/layout/wishlist.xml b/app/design/frontend/default/blank/layout/wishlist.xml
new file mode 100644
index 0000000000..8bac2778b7
--- /dev/null
+++ b/app/design/frontend/default/blank/layout/wishlist.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ wishlist wishlist/ My Wishlist
+
+
+
+
+
+
+
+
+ wishlist
+
+
+
+
+
+
+
+
+
+
+
+
+ wishlist_customer_sidebar
+
+
+
+
+
+
+
+
+
+
+ wishlist_customer_sidebar
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/locale/en_US/translate.csv b/app/design/frontend/default/blank/locale/en_US/translate.csv
new file mode 100644
index 0000000000..ab952f2ca6
--- /dev/null
+++ b/app/design/frontend/default/blank/locale/en_US/translate.csv
@@ -0,0 +1 @@
+"Keep your eyes open for our special Back to School items and save A LOT!","Keep your eyes open for our special Back to School items and save A LOT!"
diff --git a/app/design/frontend/default/blank/template/amazonpayments/asp/form.phtml b/app/design/frontend/default/blank/template/amazonpayments/asp/form.phtml
new file mode 100644
index 0000000000..059143759a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/amazonpayments/asp/form.phtml
@@ -0,0 +1,35 @@
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/amazonpayments/asp/redirect.phtml b/app/design/frontend/default/blank/template/amazonpayments/asp/redirect.phtml
new file mode 100644
index 0000000000..3fdb3f0a20
--- /dev/null
+++ b/app/design/frontend/default/blank/template/amazonpayments/asp/redirect.phtml
@@ -0,0 +1,37 @@
+
+
+
+ __('You will be redirected to Amazon Simple Pay in a few seconds.')); ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/amazonpayments/asp/shortcut.phtml b/app/design/frontend/default/blank/template/amazonpayments/asp/shortcut.phtml
new file mode 100644
index 0000000000..fcb5597618
--- /dev/null
+++ b/app/design/frontend/default/blank/template/amazonpayments/asp/shortcut.phtml
@@ -0,0 +1,33 @@
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/amazonpayments/cba/form.phtml b/app/design/frontend/default/blank/template/amazonpayments/cba/form.phtml
new file mode 100644
index 0000000000..75c294388f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/amazonpayments/cba/form.phtml
@@ -0,0 +1,35 @@
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/amazonpayments/cba/success.phtml b/app/design/frontend/default/blank/template/amazonpayments/cba/success.phtml
new file mode 100644
index 0000000000..3aa71b7c3c
--- /dev/null
+++ b/app/design/frontend/default/blank/template/amazonpayments/cba/success.phtml
@@ -0,0 +1,35 @@
+
+SUCCESS
+
+
__('Your order has been received') ?>
+
+__('Thank you for your purchase!') ?>
+__('You will receive an order confirmation email with details of your order and a link to track its progress.') ?>
+
+ __('Continue Shopping') ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/amazonpayments/form.phtml b/app/design/frontend/default/blank/template/amazonpayments/form.phtml
new file mode 100644
index 0000000000..3a7982b355
--- /dev/null
+++ b/app/design/frontend/default/blank/template/amazonpayments/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/amazonpayments/link.phtml b/app/design/frontend/default/blank/template/amazonpayments/link.phtml
new file mode 100644
index 0000000000..b0bce04616
--- /dev/null
+++ b/app/design/frontend/default/blank/template/amazonpayments/link.phtml
@@ -0,0 +1,49 @@
+
+
+
+ getIsDisabled()): ?>
+ getIsOneClickEnabled()): ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/list/partof.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/list/partof.phtml
new file mode 100644
index 0000000000..40125662df
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/list/partof.phtml
@@ -0,0 +1,52 @@
+
+getItemCollection()->getSize()): ?>
+
+
__('This product is also part of bundle(s)') ?>
+
+ setColumnCount(4); // uncomment this line if you want to have another number of columns ?>
+ resetItemsIterator() ?>
+ getRowCount();$_i++): ?>
+
+ getColumnCount();$_j++): ?>
+ getIterableItem()): ?>
+
+
+
+ getPriceHtml($_bundle, true) ?>
+ getReviewsSummaryHtml($_bundle) ?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/price.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/price.phtml
new file mode 100644
index 0000000000..754edfa0ec
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/price.phtml
@@ -0,0 +1,262 @@
+
+getProduct() ?>
+getPriceModel()->getPrices($_product) ?>
+getId() ?>
+
+
+
+getPrice($_product, $_minimalPrice); ?>
+getPrice($_product, $_minimalPrice, true); ?>
+
+getPriceType() == 1) {
+ $_weeeTaxAmount = Mage::helper('weee')->getAmount($_product);
+ if ($_weeeTaxAmount && Mage::helper('weee')->typeOfDisplay($_product, array(0, 1, 4))) {
+ $_minimalPriceTax += $_weeeTaxAmount;
+ $_minimalPriceInclTax += $_weeeTaxAmount;
+ }
+ if ($_weeeTaxAmount && Mage::helper('weee')->typeOfDisplay($_product, 2)) {
+ $_minimalPriceInclTax += $_weeeTaxAmount;
+ }
+
+ if (Mage::helper('weee')->typeOfDisplay($_product, array(1,2,4))) {
+ $_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
+ }
+}
+?>
+
+
+ getPriceView()): ?>
+
+ __('As low as') ?>:
+ helper('tax')->displayBothPrices() && $this->isRatesGraterThenZero()): ?>
+
+ __('Excl. Tax:') ?>
+ currency($_minimalPriceTax) ?>
+
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+ (
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+
+ __('Incl. Tax:') ?>
+ currency($_minimalPriceInclTax) ?>
+
+
+ currency($_minimalPriceTax) ?>
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+ (
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+ typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?>
+ currency($_minimalPriceInclTax) ?>
+
+
+
+
+ $_maximalPrice): ?>
+
+ __('From') ?>:
+ helper('tax')->displayBothPrices() && $this->isRatesGraterThenZero()): ?>
+
+ __('Excl. Tax:') ?>
+ currency($_minimalPriceTax) ?>
+
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+ (
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+
+ __('Incl. Tax:') ?>
+ currency($_minimalPriceInclTax) ?>
+
+
+ currency($_minimalPriceTax) ?>
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+ (
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+ typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?>
+ currency($_minimalPriceInclTax) ?>
+
+
+
+ getPrice($_product, $_maximalPrice); ?>
+ getPrice($_product, $_maximalPrice, true); ?>
+ getPriceType() == 1) {
+ if ($_weeeTaxAmount && Mage::helper('weee')->typeOfDisplay($_product, array(0, 1, 4))) {
+ $_maximalPriceTax += $_weeeTaxAmount;
+ $_maximalPriceInclTax += $_weeeTaxAmount;
+ }
+ if ($_weeeTaxAmount && Mage::helper('weee')->typeOfDisplay($_product, 2)) {
+ $_maximalPriceInclTax += $_weeeTaxAmount;
+ }
+ }
+ ?>
+
+ __('To') ?>:
+ helper('tax')->displayBothPrices() && $this->isRatesGraterThenZero()): ?>
+
+ __('Excl. Tax:') ?>
+ currency($_maximalPriceTax) ?>
+
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+ (
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+
+ __('Incl. Tax') ?>
+ currency($_maximalPriceInclTax) ?>
+
+
+ currency($_maximalPriceTax) ?>
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+ (
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+ typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?>
+ currency($_maximalPriceInclTax) ?>
+
+
+
+
+ helper('tax')->displayBothPrices() && $this->isRatesGraterThenZero()): ?>
+
+ __('Excl. Tax:') ?>
+ currency($_minimalPriceTax) ?>
+
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+
(
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+
+ __('Incl. Tax:') ?>
+ currency($_minimalPriceInclTax) ?>
+
+
+ currency($_minimalPriceTax) ?>
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+
(
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+ typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?>
+ currency($_minimalPriceInclTax) ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/view/price.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/view/price.phtml
new file mode 100644
index 0000000000..83adefa5d7
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/view/price.phtml
@@ -0,0 +1,93 @@
+
+getProduct() ?>
+getPrice($_product, $_product->getFinalPrice()); ?>
+getPrice($_product, $_product->getFinalPrice(), true); ?>
+
+getPriceType() == 1) {
+ $_weeeTaxAmount = Mage::helper('weee')->getAmount($_product);
+ if (Mage::helper('weee')->typeOfDisplay($_product, array(1,2,4))) {
+ $_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
+ }
+}
+?>
+
+
+
+ helper('bundle')->__('Price as configured') ?>:
+ helper('tax')->displayBothPrices() && $this->isRatesGraterThenZero()): ?>
+
+
+ __('Excl. Tax:') ?>
+ currency($_finalPrice,true,false) ?>
+
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+ (
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax,true,false) ?>
+
+
+
+ currency($_finalPrice,true,false) ?>
+ getPriceType() == 1 && Mage::helper('weee')->typeOfDisplay($_product, array(2, 1, 4))): ?>
+ (
+
+ typeOfDisplay($_product, array(2, 4))): ?>
+ getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?>
+
+ getAmount(); ?>
+
+
+
+ getName(); ?>: currency($amount, true, true); ?>
+
+
+ )
+
+
+
+
+isSaleable()): ?>
+
+
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/view/tierprices.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/view/tierprices.phtml
new file mode 100644
index 0000000000..0f7db5e415
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/view/tierprices.phtml
@@ -0,0 +1,41 @@
+
+
+getProduct();
+$_tierPrices = $this->getTierPrices();
+?>
+ 0): ?>
+
+
+ __('Buy %1$s with %2$s discount each', $_price['price_qty'], ''.($_price['price']*1).'% ') ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle.phtml
new file mode 100644
index 0000000000..92be0b07b1
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle.phtml
@@ -0,0 +1,44 @@
+
+getProduct() ?>
+
+isSaleable()): ?>
+
+ helper('catalog')->__('Availability') ?>: helper('catalog')->__('In stock') ?>
+
+ helper('catalog')->__('Availability') ?>: helper('catalog')->__('Out of stock') ?>
+
+
+
+ getPriceHtml($_product) ?>
+
+getChildHtml('bundle_prices') ?>
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/checkbox.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/checkbox.phtml
new file mode 100644
index 0000000000..d3872ff032
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/checkbox.phtml
@@ -0,0 +1,48 @@
+
+getOption() ?>
+getSelections() ?>
+htmlEscape($_option->getTitle()) ?>getRequired()) echo ' * ' ?>
+decoratedIsLast){?> class="last">
+getRequired()): ?>
+ getSelectionQtyTitlePrice($_selections[0]) ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/multi.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/multi.phtml
new file mode 100644
index 0000000000..596d22d4e8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/multi.phtml
@@ -0,0 +1,46 @@
+
+
+getOption() ?>
+getSelections() ?>
+htmlEscape($_option->getTitle()) ?>getRequired()) echo ' * ' ?>
+decoratedIsLast){?> class="last">
+ getRequired()): ?>
+ getSelectionQtyTitlePrice($_selections[0]) ?>
+
+
+
+ getRequired()): ?>
+ __('None') ?>
+
+
+ getIsDefault() && $_selection->isSaleable())?' selected="selected" ':'' ?>isSaleable()?' disabled="disabled" ':'' ?>>getSelectionQtyTitlePrice($_selection, false) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/radio.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/radio.phtml
new file mode 100644
index 0000000000..198a31dc2e
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/radio.phtml
@@ -0,0 +1,72 @@
+
+
+getOption() ?>
+getSelections() ?>
+getDefaultSelection() ?>
+getRequired()) ?>
+
+
+ getSelectionQty()*1 ?>
+ getSelectionCanChangeQty() ?>
+
+
+
+
+
+ getSelectionQty()*1 ?>
+ getSelectionCanChangeQty() ?>
+
+
+ __('Qty:') ?> id="bundle-option-getId() ?>-qty-input" class="input-text qty" type="text" name="bundle_option_qty[getId() ?>]" value="" />
+
+ htmlEscape($_option->getTitle()) ?>getRequired()) echo ' * ' ?>
+
+decoratedIsLast){?> class="last">
+ getRequired()): ?>
+ getSelectionTitlePrice($_selections[0]) ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/select.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/select.phtml
new file mode 100644
index 0000000000..e05fa20c9a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/option/select.phtml
@@ -0,0 +1,61 @@
+
+
+getOption() ?>
+getSelections() ?>
+getRequired()) ?>
+
+ getDefaultSelection()): ?>
+ getSelectionQty()*1 ?>
+ getSelectionCanChangeQty() ?>
+
+
+
+
+
+ getSelectionQty()*1 ?>
+ getSelectionCanChangeQty() ?>
+
+
+ __('Qty:') ?> id="bundle-option-getId() ?>-qty-input" class="input-text qty" type="text" name="bundle_option_qty[getId() ?>]" value="" />
+
+ htmlEscape($_option->getTitle()) ?>getRequired()) echo ' * ' ?>
+
+decoratedIsLast){?> class="last">
+
+ getSelectionTitlePrice($_selections[0]) ?>
+
+
+
+ __('Choose a selection...') ?>
+
+ getIsDefault() && $_selection->isSaleable())?' selected="selected" ':'' ?>isSaleable()?' disabled="disabled" ':'' ?>>getSelectionTitlePrice($_selection, false) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/options.phtml b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/options.phtml
new file mode 100644
index 0000000000..d2d1674535
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/catalog/product/view/type/bundle/options.phtml
@@ -0,0 +1,45 @@
+
+
+getProduct();
+$_options = Mage::helper('core')->decorateArray($this->getOptions());
+?>
+isSaleable()):?>
+
+
+
+ getSelections()): ?>
+
+
+ getOptionHtml($_option) ?>
+
+
+
+ __('No options of this product are available.') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/bundle/email/order/items/creditmemo/default.phtml b/app/design/frontend/default/blank/template/bundle/email/order/items/creditmemo/default.phtml
new file mode 100644
index 0000000000..7c283d5a0b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/email/order/items/creditmemo/default.phtml
@@ -0,0 +1,168 @@
+
+getItem() ?>
+getItem()->getOrder(); ?>
+
+getChilds($parentItem) ?>
+
+
+
+
+
+getItemOptions() || $parentItem->getDescription() || $this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+
+
+
+
+
+getOrderItem()->getParentItem()): ?>
+ getSelectionAttributes($_item) ?>
+
+
+
+
+
+
+
+
+
+
+
+ getOrderItem()->getParentItem()): ?>
+ htmlEscape($_item->getName()) ?>
+
+ getValueHtml($_item)?>
+
+ getSku() ?>
+
+ canShowPriceInfo($_item)): ?>
+ getQty()*1 ?>
+
+
+
+
+
+ canShowPriceInfo($_item)): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getDescription() ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/email/order/items/invoice/default.phtml b/app/design/frontend/default/blank/template/bundle/email/order/items/invoice/default.phtml
new file mode 100644
index 0000000000..fab4ec17ac
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/email/order/items/invoice/default.phtml
@@ -0,0 +1,169 @@
+
+
+getItem() ?>
+getChilds($parentItem) ?>
+
+getItem()->getOrder(); ?>
+
+
+
+
+
+getItemOptions() || $parentItem->getDescription() || $this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+
+
+
+
+
+getOrderItem()->getParentItem()): ?>
+ getSelectionAttributes($_item) ?>
+
+
+
+
+
+
+
+
+
+
+
+ getOrderItem()->getParentItem()): ?>
+ htmlEscape($_item->getName()) ?>
+
+ getValueHtml($_item)?>
+
+ getSku() ?>
+
+ canShowPriceInfo($_item)): ?>
+ getQty()*1 ?>
+
+
+
+
+
+ canShowPriceInfo($_item)): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getDescription() ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/email/order/items/order/default.phtml b/app/design/frontend/default/blank/template/bundle/email/order/items/order/default.phtml
new file mode 100644
index 0000000000..b9aab62906
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/email/order/items/order/default.phtml
@@ -0,0 +1,174 @@
+
+getItem() ?>
+getOrder() ?>
+
+getItem() ?>
+getChildrenItems()); ?>
+
+getItemOptions() || $_item->getDescription() || $this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
+
+
+
+
+
+
+
+
+
+getParentItem()): ?>
+ getSelectionAttributes($_item) ?>
+
+
+
+
+
+
+
+
+
+
+
+ getParentItem()): ?>
+ htmlEscape($_item->getName()) ?>
+
+ getValueHtml($_item)?>
+
+ getSku() ?>
+
+ getParentItem()): ?>
+ getQtyOrdered()*1 ?>
+
+
+
+
+
+ getParentItem()): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_item->getGiftMessageId())): ?>
+ __('Gift Message') ?>
+ __('From:'); ?> htmlEscape($_giftMessage->getSender()) ?>
+ __('To:'); ?> htmlEscape($_giftMessage->getRecipient()) ?>
+ __('Message:'); ?> htmlEscape($_giftMessage->getMessage()) ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/email/order/items/shipment/default.phtml b/app/design/frontend/default/blank/template/bundle/email/order/items/shipment/default.phtml
new file mode 100644
index 0000000000..bd40ddf998
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/email/order/items/shipment/default.phtml
@@ -0,0 +1,92 @@
+
+getItem() ?>
+
+getOrderItem()), $parentItem->getOrderItem()->getChildrenItems()) ?>
+getChilds($parentItem) ?>
+
+
+
+
+
+getItemOptions() || $parentItem->getDescription() || $this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+
+
+
+
+
+getParentItem()): ?>
+ getSelectionAttributes($_item) ?>
+
+
+
+
+
+
+
+
+
+
+ getParentItem()): ?>
+ htmlEscape($_item->getName()) ?>
+
+ getValueHtml($_item) ?>
+
+ getSku() ?>
+
+ isShipmentSeparately() && $_item->getParentItem()) || (!$this->isShipmentSeparately() && !$_item->getParentItem())): ?>
+ getId()])): ?>
+ getId()]->getQty()*1 ?>
+ getIsVirtual()): ?>
+ __('N/A') ?>
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getDescription() ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/sales/order/creditmemo/items/renderer.phtml b/app/design/frontend/default/blank/template/bundle/sales/order/creditmemo/items/renderer.phtml
new file mode 100644
index 0000000000..e109bca839
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/sales/order/creditmemo/items/renderer.phtml
@@ -0,0 +1,328 @@
+
+getItem() ?>
+
+getChilds($parentItem) ?>
+getItem()->getOrderItem()->getOrder() ?>
+
+
+
+
+
+
+
+getItemOptions() || $parentItem->getDescription() || $this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+
+
+
+
+
+getOrderItem()->getParentItem()): ?>
+ getSelectionAttributes($_item) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id="order-item-row-getId() ?>">
+ getOrderItem()->getParentItem()): ?>
+ htmlEscape($_item->getName()) ?>
+
+
+ getValueHtml($_item) ?>
+
+ getSku() ?>
+
+ canShowPriceInfo($_item)): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getPrice()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getPriceInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+ canShowPriceInfo($_item)): ?>
+ getQty()*1 ?>
+
+
+
+
+
+ canShowPriceInfo($_item)): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ getOrder()->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item)); ?>
+
+
+
+
+
+
+
+
+
+
+ canShowPriceInfo($_item)): ?>
+ getOrder()->formatPrice(-$_item->getDiscountAmount()) ?>
+
+
+
+
+
+ canShowPriceInfo($_item)): ?>
+ getOrder()->formatPrice($_item->getRowTotal()-$_item->getDiscountAmount()+$_item->getTaxAmount()+$_item->getWeeeTaxAppliedRowAmount()) ?>
+
+
+
+
+
+
+
+
+
+
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/sales/order/invoice/items/renderer.phtml b/app/design/frontend/default/blank/template/bundle/sales/order/invoice/items/renderer.phtml
new file mode 100644
index 0000000000..7bd8f30d8a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/sales/order/invoice/items/renderer.phtml
@@ -0,0 +1,352 @@
+
+getItem() ?>
+getItem()->getOrderItem()->getOrder() ?>
+
+getChilds($parentItem) ?>
+
+
+
+
+
+
+
+getItemOptions() || $parentItem->getDescription() || $this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+
+
+
+
+
+getOrderItem()->getParentItem()): ?>
+ getSelectionAttributes($_item) ?>
+
+
+
+
+
+
+
+
+
+
+
+ id="order-item-row-getId() ?>">
+ getOrderItem()->getParentItem()): ?>
+ htmlEscape($_item->getName()) ?>
+
+ getValueHtml($_item) ?>
+
+ getSku() ?>
+
+ canShowPriceInfo($_item)): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getPrice()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getPriceInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+ canShowPriceInfo($_item)): ?>
+ getQty()*1 ?>
+
+
+
+
+
+ canShowPriceInfo($_item)): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/sales/order/items/renderer.phtml b/app/design/frontend/default/blank/template/bundle/sales/order/items/renderer.phtml
new file mode 100644
index 0000000000..8a63ea5ed0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/sales/order/items/renderer.phtml
@@ -0,0 +1,375 @@
+
+getItem() ?>
+getChildrenItems()); ?>
+
+
+
+
+
+
+
+getItemOptions() || $parentItem->getDescription() || $this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+
+
+
+
+
+getParentItem()): ?>
+ getSelectionAttributes($_item) ?>
+
+ getLastRow()) echo 'class="last"'; ?>>
+
+
+
+
+
+
+
+
+
+ id="order-item-row-getId() ?>">
+
+ getParentItem()): ?>
+ htmlEscape($_item->getName()) ?>
+
+ getValueHtml($_item)?>
+
+ splitInjection($_item->getSku()) ?>
+
+ getParentItem()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getPrice()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getPriceInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+ getParentItem() && $this->isChildCalculated()) ||
+ (!$_item->getParentItem() && !$this->isChildCalculated())): ?>
+
+ getQtyOrdered() > 0): ?>
+ __('Ordered'); ?>: getQtyOrdered()*1 ?>
+
+ getQtyShipped() > 0 && !$this->isShipmentSeparately()): ?>
+ __('Shipped'); ?>: getQtyShipped()*1 ?>
+
+ getQtyCanceled() > 0): ?>
+ __('Canceled'); ?>: getQtyCanceled()*1 ?>
+
+ getQtyRefunded() > 0): ?>
+ __('Refunded'); ?>: getQtyRefunded()*1 ?>
+
+
+ getQtyShipped() > 0 && $_item->getParentItem() && $this->isShipmentSeparately()): ?>
+ __('Shipped'); ?>: getQtyShipped()*1 ?>
+
+
+
+
+
+ getParentItem()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/bundle/sales/order/shipment/items/renderer.phtml b/app/design/frontend/default/blank/template/bundle/sales/order/shipment/items/renderer.phtml
new file mode 100644
index 0000000000..044eddca97
--- /dev/null
+++ b/app/design/frontend/default/blank/template/bundle/sales/order/shipment/items/renderer.phtml
@@ -0,0 +1,111 @@
+
+getItem() ?>
+getOrderItem()), $parentItem->getOrderItem()->getChildrenItems()) ?>
+getChilds($parentItem) ?>
+
+
+
+
+
+
+
+getItemOptions() || $parentItem->getDescription() || $this->helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+
+
+
+
+
+getParentItem()): ?>
+ getSelectionAttributes($_item) ?>
+
+
+
+
+
+
+
+
+
+ id="order-item-row-getId() ?>">
+ getParentItem()): ?>
+ htmlEscape($_item->getName()) ?>
+
+ getValueHtml($_item) ?>
+
+ getSku() ?>
+
+ isShipmentSeparately() && $_item->getParentItem()) || (!$this->isShipmentSeparately() && !$_item->getParentItem())): ?>
+ getId()])): ?>
+ getId()]->getQty()*1 ?>
+ getIsVirtual()): ?>
+ __('N/A') ?>
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $parentItem) && $parentItem->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/callouts/left_col.phtml b/app/design/frontend/default/blank/template/callouts/left_col.phtml
new file mode 100644
index 0000000000..949fbcea1d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/callouts/left_col.phtml
@@ -0,0 +1,39 @@
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/callouts/right_col.phtml b/app/design/frontend/default/blank/template/callouts/right_col.phtml
new file mode 100644
index 0000000000..6b53da831f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/callouts/right_col.phtml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/category/page.phtml b/app/design/frontend/default/blank/template/catalog/category/page.phtml
new file mode 100644
index 0000000000..992a068263
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/category/page.phtml
@@ -0,0 +1,32 @@
+
+
+
getTitle() ?>
+
+
+ getContent() ?>
+
diff --git a/app/design/frontend/default/blank/template/catalog/category/view.phtml b/app/design/frontend/default/blank/template/catalog/category/view.phtml
new file mode 100644
index 0000000000..e2d13c62d9
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/category/view.phtml
@@ -0,0 +1,93 @@
+
+
+helper('catalog/output');
+ $_category = $this->getCurrentCategory();
+ $_imgHtml = '';
+ if ($_imgUrl = $_category->getImageUrl()) {
+ $_imgHtml = ' ';
+ $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
+ }
+?>
+getMessagesBlock()->getGroupedHtml() ?>
+isContentMode()): ?>
+
+ IsRssCatalogEnable() && $this->IsTopCategory()): ?>
+
+
+
categoryAttribute($_category, $this->htmlEscape($this->getCurrentCategory()->getName()), 'name') ?>
+
+
+
+
+ getCurrentCategory()->getDescription()): ?>
+ categoryAttribute($_category, $_description, 'description') ?>
+
+ getCmsBlockHtml() ?>
+isMixedMode()): ?>
+
+ IsRssCatalogEnable() && $this->IsTopCategory()): ?>
+
+
+
categoryAttribute($_category, $this->htmlEscape($this->getCurrentCategory()->getName()), 'name') ?>
+
+
+
+
+ getCurrentCategory()->getDescription()): ?>
+ categoryAttribute($_category, $_description, 'description'); ?>
+
+ IsRssCatalogEnable() && $this->IsTopCategory()): ?>
+
+
+ */ ?>
+ getCmsBlockHtml() ?>
+ getProductListHtml() ?>
+
+
+
+ IsRssCatalogEnable() && $this->IsTopCategory()): ?>
+
+
+
categoryAttribute($_category, $this->htmlEscape($this->getCurrentCategory()->getName()), 'name') ?>
+
+
+
+
+ getCurrentCategory()->getDescription()): ?>
+ categoryAttribute($_category, $_description, 'description') ?>
+
+ getProductListHtml() ?>
+
diff --git a/app/design/frontend/default/blank/template/catalog/layer/filter.phtml b/app/design/frontend/default/blank/template/catalog/layer/filter.phtml
new file mode 100644
index 0000000000..33fdd3a0c8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/layer/filter.phtml
@@ -0,0 +1,42 @@
+
+
+
+
+getItems() as $_item): ?>
+
+ getLabel() ?>
+ (getCount() ?>)
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/layer/state.phtml b/app/design/frontend/default/blank/template/catalog/layer/state.phtml
new file mode 100644
index 0000000000..0e2542a66d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/layer/state.phtml
@@ -0,0 +1,46 @@
+
+
+getActiveFilters() ?>
+
+ __('Currently Shopping by') ?>
+
+
+
+
+ __($_filter->getName()) ?>: getLabel() ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/layer/view.phtml b/app/design/frontend/default/blank/template/catalog/layer/view.phtml
new file mode 100644
index 0000000000..660d0a1544
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/layer/view.phtml
@@ -0,0 +1,55 @@
+
+
+canShowBlock()): ?>
+
+
+
__('Shop by') ?>
+
+
+ getStateHtml() ?>
+ canShowOptions()): ?>
+
__('Shopping Options') ?>
+
+ getFilters() ?>
+
+ getItemsCount()): ?>
+ __($_filter->getName()) ?>
+ getHtml() ?>
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/navigation/left.phtml b/app/design/frontend/default/blank/template/catalog/navigation/left.phtml
new file mode 100644
index 0000000000..ea70e76200
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/navigation/left.phtml
@@ -0,0 +1,58 @@
+
+
+getCurrentChildCategories() ?>
+count(); ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/navigation/top.phtml b/app/design/frontend/default/blank/template/catalog/navigation/top.phtml
new file mode 100644
index 0000000000..c22deabf66
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/navigation/top.phtml
@@ -0,0 +1,40 @@
+
+
+getStoreCategories())>1): ?>
+
+ getStoreCategories() as $_category): ?>
+ drawItem($_category) ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/compare/list.phtml b/app/design/frontend/default/blank/template/catalog/product/compare/list.phtml
new file mode 100644
index 0000000000..abae5f576f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/compare/list.phtml
@@ -0,0 +1,132 @@
+
+
+getItems()->getSize() ?>
+
+
+
+ getItems() as $_item): ?>
+
+
+
+
+
+2): ?>
+
+
+
+ getItems() as $_item): ?>
+
+
+
+
+
+
+
+
+
+
+
+ getItems() as $_item): ?>
+
+
+
+
+
+
+ getReviewsSummaryHtml($_item, 'short') ?>
+ getPriceHtml($_item, true) ?>
+ isSaleable()): ?>
+ __('Add to Cart') ?>
+
+ __('Out of stock') ?>
+
+ helper('wishlist')->isAllow()) : ?>
+ __('Add to Wishlist') ?>
+
+
+
+
+
+
+ getAttributes() as $_attribute): ?>
+
+
+ getItems() as $_item): ?>
+
+ __($_attribute->getFrontendLabel()) ?>
+
+
+ getAttributeCode()) {
+ case "price": ?>
+ getPriceHtml($_item, true) ?>
+
+
+
+ getProductAttributeValue($_item, $_attribute)) ?>
+
+
+
+
+
+
+
+
+
+ getItems() as $_item): ?>
+
+
+
+
+ getPriceHtml($_item) ?>
+ isSaleable()): ?>
+ __('Add to Cart') ?>
+
+ __('Out of stock') ?>
+
+ helper('wishlist')->isAllow()) : ?>
+ __('Add to Wishlist') ?>
+
+
+
+
+
+
+
+ __('Close Window') ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/compare/sidebar.phtml b/app/design/frontend/default/blank/template/catalog/product/compare/sidebar.phtml
new file mode 100644
index 0000000000..368a2ec873
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/compare/sidebar.phtml
@@ -0,0 +1,56 @@
+
+
+
+ helper('catalog/product_compare')->getItemCount() > 0): ?>
+
__('Compare Products - %d Items', $this->helper('catalog/product_compare')->getItemCount()) ?>
+
+ __('Compare Products') ?>
+
+
+
+ helper('catalog/product_compare')->getItemCount() > 0): ?>
+
+ helper('catalog/product_compare')->getItemCollection() as $_index=>$_item): ?>
+
+
+
+ htmlEscape($_item->getName()) ?>
+
+
+
+
+
+
+
__('You have no items to compare.') ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/gallery.phtml b/app/design/frontend/default/blank/template/catalog/product/gallery.phtml
new file mode 100644
index 0000000000..96e3348622
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/gallery.phtml
@@ -0,0 +1,63 @@
+
+getImageWidth() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/list.phtml b/app/design/frontend/default/blank/template/catalog/product/list.phtml
new file mode 100644
index 0000000000..858576b3c5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/list.phtml
@@ -0,0 +1,129 @@
+
+
+getLoadedProductCollection() ?>
+count()): ?>
+__('There are no products matching the selection.') ?>
+
+
+ getToolbarHtml() ?>
+
+
+ getMode()!='grid'): ?>
+
+
+
+
+
+
+
+
+
+
+
+ getRatingSummary()): ?>
+ getReviewsSummaryHtml($_product) ?>
+
+ getPriceHtml($_product, true) ?>
+ isSaleable()): ?>
+
__('Add to Cart') ?>
+
+
__('Out of stock') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ count() ?>
+
+ getColumnCount(); ?>
+
+
+
+
+
+
+
+
+ getRatingSummary()): ?>
+ getReviewsSummaryHtml($_product, 'short') ?>
+
+ getPriceHtml($_product, true) ?>
+ isSaleable()): ?>
+ __('Add to Cart') ?>
+
+ __('Out of stock') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getToolbarHtml() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/list/related.phtml b/app/design/frontend/default/blank/template/catalog/product/list/related.phtml
new file mode 100644
index 0000000000..c8f10d52b8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/list/related.phtml
@@ -0,0 +1,94 @@
+
+getItems()->getSize()): ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/list/toolbar.phtml b/app/design/frontend/default/blank/template/catalog/product/list/toolbar.phtml
new file mode 100644
index 0000000000..6237080e90
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/list/toolbar.phtml
@@ -0,0 +1,112 @@
+
+
+getCollection()->getSize()): ?>
+
+
+isExpanded() ): ?>
+
+ isEnabledViewSwitcher() ): ?>
+
+ getModes(); ?>
+ 1): ?>
+ __('View as') ?>:
+ getModes() as $_code=>$_label): ?>
+ isModeActive($_code)): ?>
+
+
+
+
+
+
+
+
+
+
+ __('Sort by') ?>
+
+ getAvailableOrders() as $_key=>$_order): ?>
+ isOrderCurrent($_key)): ?> selected="selected">
+
+
+
+
+ getCurrentDirection() == 'desc'): ?>
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/list/upsell.phtml b/app/design/frontend/default/blank/template/catalog/product/list/upsell.phtml
new file mode 100644
index 0000000000..75efae5dc4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/list/upsell.phtml
@@ -0,0 +1,52 @@
+
+getItemCollection()->getItems())): ?>
+
+
__('You may also be interested in the following product(s)') ?>
+
+ setColumnCount(5); // uncomment this line if you want to have another number of columns. also can be changed in layout ?>
+ resetItemsIterator() ?>
+ getRowCount();$_i++): ?>
+
+ getColumnCount();$_j++): ?>
+ getIterableItem()): ?>
+
+
+
+ getPriceHtml($_link, true) ?>
+ getReviewsSummaryHtml($_link) ?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/new.phtml b/app/design/frontend/default/blank/template/catalog/product/new.phtml
new file mode 100644
index 0000000000..7bf85d39ae
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/new.phtml
@@ -0,0 +1,60 @@
+
+getProductCollection()) && $_products->getSize()): ?>
+
+
__('New Products') ?>
+
+
+
+ getItems() as $_product): ?>
+ 5): continue; endif; ?>
+
+
+
+ getReviewsSummaryHtml($_product, 'short') ?>
+ getPriceHtml($_product, true, '-new') ?>
+ isSaleable()): ?>
+ __('Add to Cart') ?>
+
+ __('Out of stock') ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/price.phtml b/app/design/frontend/default/blank/template/catalog/product/price.phtml
new file mode 100644
index 0000000000..29ac5ae9eb
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/price.phtml
@@ -0,0 +1,344 @@
+
+
+
+
+getProduct() ?>
+getId() ?>
+
+
+
+helper('tax')->displayPriceIncludingTax() || $this->helper('tax')->displayBothPrices()); ?>
+
+getMinimalPrice() ?>
+helper('tax')->getPrice($_product, $_minimalPriceValue, $simplePricesTax) ?>
+
+isGrouped()): ?>
+ getAmountForDisplay($_product); ?>
+ typeOfDisplay($_product, array(1,2,4))): ?>
+ getAmount($_product); ?>
+ getProductWeeeAttributesForDisplay($_product); ?>
+
+
+
+ helper('tax')->getPrice($_product, $_product->getPrice()) ?>
+ helper('tax')->getPrice($_product, $_product->getPrice(), $simplePricesTax) ?>
+ helper('tax')->getPrice($_product, $_product->getFinalPrice()) ?>
+ helper('tax')->getPrice($_product, $_product->getFinalPrice(), true) ?>
+ getPriceDisplayType(); ?>
+
+ helper('tax')->displayBothPrices() && $_finalPriceInclTax != $_finalPrice): ?>
+ typeOfDisplay($_product, 0)): // including ?>
+
+ __('Excl. Tax:') ?>
+ currency($_price+$_weeeTaxAmount,true,false) ?>
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
+
+ typeOfDisplay($_product, 1)): // incl. + weee ?>
+
+ __('Excl. Tax:') ?>
+ currency($_price+$_weeeTaxAmount,true,false) ?>
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
+
+ (
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?>
+
+
+ )
+
+ typeOfDisplay($_product, 4)): // incl. + weee ?>
+
+ __('Excl. Tax:') ?>
+ currency($_price+$_weeeTaxAmount,true,false) ?>
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
+
+ (
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), true, true); ?>
+
+
+ )
+
+ typeOfDisplay($_product, 2)): // excl. + weee + final ?>
+
+ __('Excl. Tax:') ?>
+ currency($_price,true,false) ?>
+
+
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?>
+
+
+
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
+
+
+
+ __('Excl. Tax:') ?>
+ currency($_price,true,false) ?>
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax,true,false) ?>
+
+
+
+ typeOfDisplay($_product, 0)): // including ?>
+
currency($_price+$_weeeTaxAmount,true,true) ?>
+ typeOfDisplay($_product, 1)): // incl. + weee ?>
+
currency($_price+$_weeeTaxAmount,true,true) ?>
+
+
(
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?>
+
+
+ )
+ typeOfDisplay($_product, 4)): // incl. + weee ?>
+
currency($_price+$_weeeTaxAmount,true,true) ?>
+
+
(
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), true, true); ?>
+
+
+ )
+ typeOfDisplay($_product, 2)): // excl. + weee + final ?>
+
currency($_price,true,true) ?>
+
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?>
+
+
+
+
+
currency($_price+$_weeeTaxAmount,true,true) ?>
+
+
currency($_price,true,true) ?>
+
+
+
+ getOriginalAmount($_product); ?>
+
+ typeOfDisplay($_product, 0)): // including ?>
+
+ __('Regular Price:') ?>
+ currency($_regularPrice+$_originalWeeeTaxAmount,true,false) ?>
+
+
+ helper('tax')->displayBothPrices() && $_finalPriceInclTax != $_finalPrice): ?>
+
+ __('Special Price:') ?>
+
+ __('Excl. Tax:') ?>
+ currency($_finalPrice+$_weeeTaxAmount,true,false) ?>
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
+
+
+
+
+ __('Special Price:') ?>
+ currency($_finalPrice+$_weeeTaxAmount,true,false) ?>
+
+
+
+ typeOfDisplay($_product, 1)): // incl. + weee ?>
+
+ __('Regular Price:') ?>
+ currency($_regularPrice+$_originalWeeeTaxAmount,true,false) ?>
+
+
+
+ __('Special Price:') ?>
+
+ __('Excl. Tax:') ?>
+ currency($_finalPrice+$_weeeTaxAmount,true,false) ?>
+
+
+ (
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?>
+
+
+ )
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
+
+
+ typeOfDisplay($_product, 4)): // incl. + weee ?>
+
+ __('Regular Price:') ?>
+ currency($_regularPrice+$_originalWeeeTaxAmount,true,false) ?>
+
+
+
+ __('Special Price:') ?>
+
+ __('Excl. Tax:') ?>
+ currency($_finalPrice+$_weeeTaxAmount,true,false) ?>
+
+
+ (
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(), true, true); ?>
+
+
+ )
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
+
+
+ typeOfDisplay($_product, 2)): // excl. + weee + final ?>
+
+ __('Regular Price:') ?>
+ currency($_regularPrice,true,false) ?>
+
+
+
+ __('Special Price:') ?>
+
+ __('Excl. Tax:') ?>
+ currency($_finalPrice,true,false) ?>
+
+
+
+
+ getName(); ?>: currency($_weeeTaxAttribute->getAmount(), true, true); ?>
+
+
+
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?>
+
+
+
+
+ __('Regular Price:') ?>
+ currency($_regularPrice,true,false) ?>
+
+
+ helper('tax')->displayBothPrices() && $_finalPriceInclTax != $_finalPrice): ?>
+
+ __('Special Price:') ?>
+
+ __('Excl. Tax:') ?>
+ currency($_finalPrice,true,false) ?>
+
+
+ __('Incl. Tax:') ?>
+ currency($_finalPriceInclTax,true,false) ?>
+
+
+
+
+ __('Special Price:') ?>
+ currency($_finalPrice,true,false) ?>
+
+
+
+
+
+
+ getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_product->getFinalPrice()): ?>
+
+
+ typeOfDisplay($_product, array(0, 1, 4))): ?>
+
+
+
+
+ __('As low as:') ?>
+ currency($_minimalPriceDisplayValue,true,false) ?>
+
+ getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?>
+
+
+isGrouped()): */ ?>
+ helper('tax')->getPrice($_product, $_minimalPriceValue, $includingTax = null);
+ $_inclTax = $this->helper('tax')->getPrice($_product, $_minimalPriceValue, $includingTax = true);
+ ?>
+ getDisplayMinimalPrice() && $_minimalPriceValue): ?>
+
+
+ __('Starting at:') ?>
+ helper('tax')->displayBothPrices() && ($_exclTax !== $_inclTax)): ?>
+
+ __('Excl. Tax:') ?>
+ currency($_exclTax, true, false) ?>
+
+
+ __('Incl. Tax:') ?>
+ currency($_inclTax, true, false) ?>
+
+
+ helper('tax')->displayPriceIncludingTax()) {
+ $_showPrice = $_exclTax;
+ }
+ ?>
+ currency($_showPrice, true, false) ?>
+
+
+
+ getDisplayMinimalPrice() && $_minimalPrice): */ ?>
+isGrouped()): */ ?>
diff --git a/app/design/frontend/default/blank/template/catalog/product/view.phtml b/app/design/frontend/default/blank/template/catalog/product/view.phtml
new file mode 100644
index 0000000000..0328434100
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view.phtml
@@ -0,0 +1,129 @@
+
+helper('catalog/output');
+ $_product = $this->getProduct();
+?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
+
+
+ getChildHtml('description')):?>
+
+
__('Product Description') ?>
+
+
+
+ getChildHtml('additional')):?>
+
+
__('Additional Information') ?>
+
+
+
+ getChildHtml('upsell_products') ?>
+ getChildHtml('product_additional_data') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/additional.phtml b/app/design/frontend/default/blank/template/catalog/product/view/additional.phtml
new file mode 100644
index 0000000000..f59da9e073
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/additional.phtml
@@ -0,0 +1,29 @@
+
+getChildHtmlList() as $_html): ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/addto.phtml b/app/design/frontend/default/blank/template/catalog/product/view/addto.phtml
new file mode 100644
index 0000000000..50aaf2a2ca
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/addto.phtml
@@ -0,0 +1,36 @@
+
+
+getProduct() ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/addtocart.phtml b/app/design/frontend/default/blank/template/catalog/product/view/addtocart.phtml
new file mode 100644
index 0000000000..fca8b5f0b3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/addtocart.phtml
@@ -0,0 +1,39 @@
+
+
+getProduct() ?>
+
+isSaleable()): ?>
+
+ __('Add Items to Cart') ?>
+ isGrouped()): ?>
+ __('Qty') ?>:
+
+
+ __('Add to Cart') ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/attributes.phtml b/app/design/frontend/default/blank/template/catalog/product/view/attributes.phtml
new file mode 100644
index 0000000000..a7de39a83c
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/attributes.phtml
@@ -0,0 +1,49 @@
+
+helper('catalog/output');
+ $_product = $this->getProduct()
+?>
+getAdditionalData()): ?>
+
+
+
+
+
+ __($_data['label']) ?>
+ productAttribute($_product, $_data['value'], $_data['code']) ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/description.phtml b/app/design/frontend/default/blank/template/catalog/product/view/description.phtml
new file mode 100644
index 0000000000..5aadec34bc
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/description.phtml
@@ -0,0 +1,35 @@
+
+
+ helper('catalog/output')->productAttribute($this->getProduct(), nl2br($this->getProduct()->getDescription()), 'description') ?>
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/media.phtml b/app/design/frontend/default/blank/template/catalog/product/view/media.phtml
new file mode 100644
index 0000000000..98a1ca01c6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/media.phtml
@@ -0,0 +1,78 @@
+
+getProduct();
+ $_helper = $this->helper('catalog/output');
+?>
+getImage() != 'no_selection' && $_product->getImage()): ?>
+
+ helper('catalog/image')->init($_product, 'image').'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
+ echo $_helper->productAttribute($_product, $_img, 'image');
+ ?>
+
+__('Double click on above image to view full picture') ?>
+
+
+
+
+
+
+
+
+ helper('catalog/image')->init($_product, 'image')->resize(265).'" alt="'.$this->htmlEscape($_product->getImageLabel()).'" title="'.$this->htmlEscape($_product->getImageLabel()).'" />';
+ echo $_helper->productAttribute($_product, $_img, 'image');
+ ?>
+
+
+getGalleryImages()) > 0): ?>
+
+
__('More Views') ?>
+
+ getGalleryImages() as $_image): ?>
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options.phtml
new file mode 100644
index 0000000000..443f4e01b8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options.phtml
@@ -0,0 +1,176 @@
+
+
+decorateArray($this->getOptions()) ?>
+
+
+
+
+ getOptionHtml($_option) ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options/js.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options/js.phtml
new file mode 100644
index 0000000000..2ff3685e51
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options/js.phtml
@@ -0,0 +1,60 @@
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options/type/date.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options/type/date.phtml
new file mode 100644
index 0000000000..c53dc048a4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options/type/date.phtml
@@ -0,0 +1,70 @@
+
+getOption() ?>
+getId() ?>
+htmlEscape($_option->getTitle()) ?>getIsRequire()): ?> *
+ getFormatedPrice() ?>
+decoratedIsLast){?> class="last">
+
+getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE_TIME
+ || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE): ?>
+
+ getDateHtml() ?>
+
+ useCalendar()): ?>
+
+
+
+
+
+getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_DATE_TIME
+ || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_TIME): ?>
+ getTimeHtml() ?>
+
+
+getIsRequire()): ?>
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options/type/default.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options/type/default.phtml
new file mode 100644
index 0000000000..422a6b44da
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options/type/default.phtml
@@ -0,0 +1,30 @@
+
+getOption() ?>
+
+ htmlEscape($_option->getTitle()) ?>
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options/type/file.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options/type/file.phtml
new file mode 100644
index 0000000000..a1b4219377
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options/type/file.phtml
@@ -0,0 +1,41 @@
+
+getOption() ?>
+htmlEscape($_option->getTitle()) ?>getIsRequire()): ?> *
+ getFormatedPrice() ?>
+decoratedIsLast){?> class="last">
+
+getFileExtension()): ?>
+__('Allowed file extensions to upload')?>: getFileExtension() ?>
+
+getImageSizeX() > 0): ?>
+__('Maximum image width')?>: getImageSizeX() ?> __('px.')?>
+
+getImageSizeY() > 0): ?>
+__('Maximum image height')?>: getImageSizeY() ?> __('px.')?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options/type/select.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options/type/select.phtml
new file mode 100644
index 0000000000..33a8d53999
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options/type/select.phtml
@@ -0,0 +1,37 @@
+
+
+getOption() ?>
+htmlEscape($_option->getTitle()) ?>getIsRequire()): ?> *
+decoratedIsLast){?> class="last">
+ getValuesHtml() ?>
+ getIsRequire()): ?>
+ getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_RADIO || $_option->getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_CHECKBOX): ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options/type/text.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options/type/text.phtml
new file mode 100644
index 0000000000..de538a59b5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options/type/text.phtml
@@ -0,0 +1,39 @@
+
+getOption() ?>
+htmlEscape($_option->getTitle()) ?>getIsRequire()): ?> *
+ getFormatedPrice() ?>
+decoratedIsLast){?> class="last">
+getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_FIELD): ?>
+
+getType() == Mage_Catalog_Model_Product_Option::OPTION_TYPE_AREA): ?>
+
+
+getMaxCharacters()): ?>
+__('Maximum number of characters')?>: getMaxCharacters() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options/wrapper.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options/wrapper.phtml
new file mode 100644
index 0000000000..85b715c6d5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options/wrapper.phtml
@@ -0,0 +1,33 @@
+
+
+ getChildHtml('', true, true);?>
+ hasRequiredOptions()):?>
+ __('* Required Fields') ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/options/wrapper/bottom.phtml b/app/design/frontend/default/blank/template/catalog/product/view/options/wrapper/bottom.phtml
new file mode 100644
index 0000000000..6f2013796d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/options/wrapper/bottom.phtml
@@ -0,0 +1,29 @@
+
+
+ getChildHtml('', true, true);?>
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/price.phtml b/app/design/frontend/default/blank/template/catalog/product/view/price.phtml
new file mode 100644
index 0000000000..41cd1fab3d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/price.phtml
@@ -0,0 +1,30 @@
+
+
+
__('Old Price:') ?> getPrice() ?>
+
getPrice() ?>
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/price_clone.phtml b/app/design/frontend/default/blank/template/catalog/product/view/price_clone.phtml
new file mode 100644
index 0000000000..fe85bcbe77
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/price_clone.phtml
@@ -0,0 +1,28 @@
+
+getProduct() ?>
+getPriceHtml($_product, false, '_clone') ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/tierprices.phtml b/app/design/frontend/default/blank/template/catalog/product/view/tierprices.phtml
new file mode 100644
index 0000000000..533379904d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/tierprices.phtml
@@ -0,0 +1,181 @@
+
+
+getProduct();
+$_tierPrices = $this->getTierPrices();
+$_finalPriceInclTax = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice(), true);
+
+$_weeeTaxAmount = Mage::helper('weee')->getAmountForDisplay($_product);
+if (Mage::helper('weee')->typeOfDisplay($_product, array(1,2,4))) {
+ $_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
+}
+
+?>
+ 0): ?>
+
+ getInGrouped()): ?>
+ getTierPrices($_product); ?>
+
+ processTierPrices($_product, $_tierPrices); ?>
+
+
+ helper('tax')->displayBothPrices() && $_price['formated_price'] != $_price['formated_price_incl_tax']): ?>
+ typeOfDisplay($_product, 0)): ?>
+ __('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']) ?>
+ typeOfDisplay($_product, 1)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']); ?>
+
+ (
+ __('%1$s incl tax.', $_price['formated_price_incl_weee']); ?>
+
+
+ getName(); ?>: currency($_attribute->getAmount()); ?>
+
+ )
+
+ __('each') ?>
+ typeOfDisplay($_product, 4)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']); ?>
+
+ (
+ __('%1$s incl tax.', $_price['formated_price_incl_weee']); ?>
+
+
+ getName(); ?>: currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?>
+
+ )
+
+ __('each') ?>
+ typeOfDisplay($_product, 2)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price']); ?>
+
+ (
+
+ getName(); ?>: currency($_attribute->getAmount()); ?>
+
+ __('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']); ?>
+ )
+
+ __('each') ?>
+
+ __('Buy %1$s for %2$s (%3$s incl. tax) each', $_price['price_qty'], $_price['formated_price'], $_price['formated_price_incl_tax']) ?>
+
+
+ helper('tax')->displayPriceIncludingTax()): ?>
+ typeOfDisplay($_product, 0)): ?>
+ __('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price_incl_weee']) ?>
+ typeOfDisplay($_product, 1)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee']); ?>
+
+ (
+
+
+ getName(); ?>: currency($_attribute->getAmount()); ?>
+
+ )
+
+ __('each') ?>
+ typeOfDisplay($_product, 4)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee']); ?>
+
+ (
+
+
+ getName(); ?>: currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?>
+
+ )
+
+ __('each') ?>
+ typeOfDisplay($_product, 2)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_tax']); ?>
+
+ (
+
+ getName(); ?>: currency($_attribute->getAmount()); ?>
+
+ __('Total incl. Tax: %1$s', $_price['formated_price_incl_weee']); ?>
+ )
+
+ __('each') ?>
+
+ __('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price_incl_tax']) ?>
+
+
+ typeOfDisplay($_product, 0)): ?>
+ __('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price_incl_weee_only']) ?>
+ typeOfDisplay($_product, 1)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']); ?>
+
+ (
+
+
+ getName(); ?>: currency($_attribute->getAmount()); ?>
+
+ )
+
+ __('each') ?>
+ typeOfDisplay($_product, 4)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price_incl_weee_only']); ?>
+
+ (
+
+
+ getName(); ?>: currency($_attribute->getAmount()+$_attribute->getTaxAmount()); ?>
+
+ )
+
+ __('each') ?>
+ typeOfDisplay($_product, 2)): ?>
+ __('Buy %1$s for %2$s', $_price['price_qty'], $_price['formated_price']); ?>
+
+ (
+
+ getName(); ?>: currency($_attribute->getAmount()); ?>
+
+ __('Total incl. Tax: %1$s', $_price['formated_price_incl_weee_only']); ?>
+ )
+
+ __('each') ?>
+
+ __('Buy %1$s for %2$s each', $_price['price_qty'], $_price['formated_price']) ?>
+
+
+
+ getInGrouped()): ?>
+ getPrice() == $_product->getFinalPrice() && $_product->getPrice() > $_price['price'])
+ || ($_product->getPrice() != $_product->getFinalPrice() && $_product->getFinalPrice() > $_price['price'])): ?>
+ __('and') ?> __('save')?> %
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/type/configurable.phtml b/app/design/frontend/default/blank/template/catalog/product/view/type/configurable.phtml
new file mode 100644
index 0000000000..c7e4b13e81
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/type/configurable.phtml
@@ -0,0 +1,39 @@
+
+getProduct() ?>
+isSaleable()): ?>
+ __('Availability') ?>: __('In stock') ?>
+
+ __('Availability') ?>: __('Out of stock') ?>
+
+getPriceHtml($_product) ?>
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/type/grouped.phtml b/app/design/frontend/default/blank/template/catalog/product/view/type/grouped.phtml
new file mode 100644
index 0000000000..26d846d9a4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/type/grouped.phtml
@@ -0,0 +1,80 @@
+
+getProduct() ?>
+getAssociatedProducts() ?>
+isSaleable() && count($_associatedProducts)): ?>
+ __('Availability') ?>: __('In stock') ?>
+
+ __('Availability') ?>: __('Out of stock') ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/type/options/configurable.phtml b/app/design/frontend/default/blank/template/catalog/product/view/type/options/configurable.phtml
new file mode 100644
index 0000000000..824ec8123f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/type/options/configurable.phtml
@@ -0,0 +1,46 @@
+
+
+getProduct();
+$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
+?>
+isSaleable() && count($_attributes)):?>
+
+
+ getLabel() ?> *
+ decoratedIsLast){?> class="last">
+
+ __('Choose an Option...') ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/type/simple.phtml b/app/design/frontend/default/blank/template/catalog/product/view/type/simple.phtml
new file mode 100644
index 0000000000..1c83f66925
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/type/simple.phtml
@@ -0,0 +1,40 @@
+
+getProduct() ?>
+
+isSaleable()): ?>
+ __('Availability') ?>: __('In stock') ?>
+
+ __('Availability') ?>: __('Out of stock') ?>
+
+getPriceHtml($_product) ?>
diff --git a/app/design/frontend/default/blank/template/catalog/product/view/type/virtual.phtml b/app/design/frontend/default/blank/template/catalog/product/view/type/virtual.phtml
new file mode 100644
index 0000000000..1c83f66925
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/product/view/type/virtual.phtml
@@ -0,0 +1,40 @@
+
+getProduct() ?>
+
+isSaleable()): ?>
+ __('Availability') ?>: __('In stock') ?>
+
+ __('Availability') ?>: __('Out of stock') ?>
+
+getPriceHtml($_product) ?>
diff --git a/app/design/frontend/default/blank/template/catalog/seo/sitemap.phtml b/app/design/frontend/default/blank/template/catalog/seo/sitemap.phtml
new file mode 100644
index 0000000000..93a85d66c1
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/seo/sitemap.phtml
@@ -0,0 +1,43 @@
+
+
+getCollection(); ?>
+getSize()): ?>
+
+
+
+ __('There are no %s available.', $this->getItemsTitle()); ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalog/seo/sitemap/container.phtml b/app/design/frontend/default/blank/template/catalog/seo/sitemap/container.phtml
new file mode 100644
index 0000000000..a04b3a9dd8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/seo/sitemap/container.phtml
@@ -0,0 +1,33 @@
+
+
+
getTitle() ?>
+
+getChildHtml('links') ?>
+getChildHtml('pager_top') ?>
+getChildHtml('sitemap') ?>
+getChildHtml('pager_bottom') ?>
diff --git a/app/design/frontend/default/blank/template/catalog/seo/tree.phtml b/app/design/frontend/default/blank/template/catalog/seo/tree.phtml
new file mode 100644
index 0000000000..64d7443212
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalog/seo/tree.phtml
@@ -0,0 +1,43 @@
+
+
+getCollection(); ?>
+getSize()): ?>
+
+
+ getLevel($_item)?'style="padding-left:' . $this->getLevel($_item, 2) . '0px;"':'' ?>>name ?>
+
+
+
+
+ __('There are no %s available.', $this->getItemsTitle()); ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalogsearch/advanced/form.phtml b/app/design/frontend/default/blank/template/catalogsearch/advanced/form.phtml
new file mode 100644
index 0000000000..e91a3e98d2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalogsearch/advanced/form.phtml
@@ -0,0 +1,91 @@
+
+
+
+
__('Catalog Advanced Search') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalogsearch/advanced/result.phtml b/app/design/frontend/default/blank/template/catalogsearch/advanced/result.phtml
new file mode 100644
index 0000000000..2b8c5307ae
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalogsearch/advanced/result.phtml
@@ -0,0 +1,61 @@
+
+
+
__('Catalog Advanced Search') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+getResultCount()): ?>
+
+ helper('catalogsearch')
+ ->__('%d item(s) were found using the following search criteria', $this->getResultCount()); ?>
+
+
+ helper('catalogsearch')->__('No items were found using the following search criteria.');?> helper('catalogsearch')->__('Modify your search'); ?>
+
+
+getSearchCriterias(); ?>
+
+
+
+
+
+ htmlEscape($this->helper('catalog')->__($criteria['name'])); ?>: htmlEscape($criteria['value']); ?>
+
+
+
+
+
+getResultCount()): ?>
+
+ helper('catalogsearch')->__("Don't see what you're looking for?"); ?>
+ helper('catalogsearch')->__('Modify your search'); ?>
+
+
+getResultCount()): ?>
+ getProductListHtml() ?>
+
+getSearchCriterias(); ?>
diff --git a/app/design/frontend/default/blank/template/catalogsearch/form.mini.phtml b/app/design/frontend/default/blank/template/catalogsearch/form.mini.phtml
new file mode 100644
index 0000000000..17a2f81c85
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalogsearch/form.mini.phtml
@@ -0,0 +1,41 @@
+
+
diff --git a/app/design/frontend/default/blank/template/catalogsearch/result.phtml b/app/design/frontend/default/blank/template/catalogsearch/result.phtml
new file mode 100644
index 0000000000..8c053fa935
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalogsearch/result.phtml
@@ -0,0 +1,43 @@
+
+getResultCount()): ?>
+getMessagesBlock()->getGroupedHtml() ?>
+
+ helper('rss/catalog')->getTagFeedUrl()): ?>
+
+
+
getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?>
+
+ getProductListHtml() ?>
+
+
+
getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?>
+
+
+ getNoResultText()) ? $this->getNoResultText() : $this->__('Your search returns no results.') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/catalogsearch/term.phtml b/app/design/frontend/default/blank/template/catalogsearch/term.phtml
new file mode 100644
index 0000000000..3f5e6834b4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/catalogsearch/term.phtml
@@ -0,0 +1,38 @@
+
+
+
__('Popular Search Terms') ?>
+
+getTerms()) > 0 ): ?>
+
+
+ __('There are no search terms available.'); ?>
+
diff --git a/app/design/frontend/default/blank/template/checkout/cart.phtml b/app/design/frontend/default/blank/template/checkout/cart.phtml
new file mode 100644
index 0000000000..6c0bea87cb
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart.phtml
@@ -0,0 +1,125 @@
+
+
+
+
+
__('Shopping Cart') ?>
+ hasError()): ?>
+
+ getChildHtml('top_methods') ?>
+
+
+
+ getMessagesBlock()->getGroupedHtml() ?>
+
+
+
+ getChildHtml('crosssell') ?>
+
+
+ getChildHtml('coupon') ?>
+ getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>
+
+
+
+ getChildHtml('totals'); ?>
+ hasError()): ?>
+
+ getChildHtml('methods') ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/cart/coupon.phtml b/app/design/frontend/default/blank/template/checkout/cart/coupon.phtml
new file mode 100644
index 0000000000..674825a6e6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/coupon.phtml
@@ -0,0 +1,58 @@
+
+
+
__('Discount Codes') ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/checkout/cart/crosssell.phtml b/app/design/frontend/default/blank/template/checkout/cart/crosssell.phtml
new file mode 100644
index 0000000000..119c589f0f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/crosssell.phtml
@@ -0,0 +1,58 @@
+
+
+getItemCount()): ?>
+
+
__('Based on your selection, you may be interested in the following items:') ?>
+
+ getItems() as $_item): ?>
+
+
+
+
+ getPriceHtml($_item, true) ?>
+
__('Add to Cart') ?>
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/cart/item/default.phtml b/app/design/frontend/default/blank/template/checkout/cart/item/default.phtml
new file mode 100644
index 0000000000..80a4b8b240
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/item/default.phtml
@@ -0,0 +1,257 @@
+
+getItem()?>
+
+
+ hasProductUrl()):?>
+
+ hasProductUrl()):?>
+
+ hasProductUrl()):?>
+ getProductName() ?>
+
+ getProductName() ?>
+
+ getOptionList()):?>
+
+
+ getFormatedOptionValue($_option) ?>
+ htmlEscape($_option['label']) ?>
+ class="truncated">
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+
+
+ getMessages()): ?>
+
+ *
+
+
+
+ helper('wishlist')->isAllowInCart()) : ?>
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
+
+ helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
+
+
+
+
+
+ getApplied($_item)): ?>
+
+
+ typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+
+
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->getPriceInclTax($_item); ?>
+ typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
+
+ helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+
+ typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+
+
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
+
+
+
+
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ helper('checkout')->formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+
+ typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+
+
+
+
+ getApplied($_item)): ?>
+
+
+ typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/cart/noItems.phtml b/app/design/frontend/default/blank/template/checkout/cart/noItems.phtml
new file mode 100644
index 0000000000..0e049fb088
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/noItems.phtml
@@ -0,0 +1,32 @@
+
+
+
__('Shopping Cart is Empty') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+__('You have no items in your shopping cart.') ?>
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
diff --git a/app/design/frontend/default/blank/template/checkout/cart/render/default.phtml b/app/design/frontend/default/blank/template/checkout/cart/render/default.phtml
new file mode 100644
index 0000000000..efa6762ce4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/render/default.phtml
@@ -0,0 +1,66 @@
+
+getItem() ?>
+
+
+
+
+
+ getItemDescription($_item) ?>
+ getMessage()): ?>
+ * getMessage() ?>
+
+
+ helper('wishlist')->isAllowInCart()) : ?>
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item)); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($_item->getRowTotal()) ?>
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item)); ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/cart/render/simple.phtml b/app/design/frontend/default/blank/template/checkout/cart/render/simple.phtml
new file mode 100644
index 0000000000..7c01bb628a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/render/simple.phtml
@@ -0,0 +1,66 @@
+
+getItem() ?>
+
+
+
+
+
+ getItemDescription($_item) ?>
+ getMessage()): ?>
+ * getMessage() ?>
+
+
+ helper('wishlist')->isAllowInCart()) : ?>
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item)); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($_item->getRowTotal()) ?>
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item)); ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/cart/shipping.phtml b/app/design/frontend/default/blank/template/checkout/cart/shipping.phtml
new file mode 100644
index 0000000000..26b05999ca
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/shipping.phtml
@@ -0,0 +1,118 @@
+
+
+
+
__('Estimate Shipping and Tax') ?>
+
+
+
+getEstimateRates())): ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/cart/sidebar.phtml b/app/design/frontend/default/blank/template/checkout/cart/sidebar.phtml
new file mode 100644
index 0000000000..b67a5139c0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/sidebar.phtml
@@ -0,0 +1,70 @@
+
+
+ getSummaryCount() ?>
+
+
__('My Cart') ?>
+
+
+ 0): ?>
+
+
__('There is 1 item in your cart.', $this->getUrl('checkout/cart')) ?>
+
+
__('There are %s items in your cart.', $this->getUrl('checkout/cart'), $_cartQty) ?>
+
+
+ __('Cart Subtotal:') ?> formatPrice($this->getSubtotal()) ?>
+ getSubtotalInclTax()): ?>
+ (formatPrice($_subtotalInclTax) ?> getIncExcText(true) ?>)
+
+
+
+ isPossibleOnepageCheckout()): ?>
+
+ __('Checkout') ?>
+
+
+ getRecentItems() ?>
+
+
__('Recently added item(s)') ?>
+
+
+
+
__('You have no items in your shopping cart.') ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/cart/sidebar/default.phtml b/app/design/frontend/default/blank/template/checkout/cart/sidebar/default.phtml
new file mode 100644
index 0000000000..68a460fd85
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/sidebar/default.phtml
@@ -0,0 +1,127 @@
+
+getItem() ?>
+
+
+
+
+
+
getQty() ?> x
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
+ helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
+
+ helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'sales')): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales')): ?>
+ getApplied($_item) as $tax): ?>
+
: formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales')): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+
+
+ typeOfDisplay($_item, 2, 'sales')): ?>
+
__('Total'); ?>: helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+ helper('checkout')->getPriceInclTax($_item); ?>
+ helper('tax')->displayCartBothPrices()): ?>
+
__('Incl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
+ helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
+
+ helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'sales')): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales')): ?>
+ getApplied($_item) as $tax): ?>
+
: formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales')): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+
+
+ typeOfDisplay($_item, 2, 'sales')): ?>
+
__('Total incl. tax'); ?>: helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
+
+
+
+ getOptionList()):?>
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+
+
+
+
+
__('Details') ?>
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/checkout/cart/totals.phtml b/app/design/frontend/default/blank/template/checkout/cart/totals.phtml
new file mode 100644
index 0000000000..c8bee706c2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/cart/totals.phtml
@@ -0,0 +1,43 @@
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/links.phtml b/app/design/frontend/default/blank/template/checkout/links.phtml
new file mode 100644
index 0000000000..ecbe3473a8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/links.phtml
@@ -0,0 +1,26 @@
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/address/select.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/address/select.phtml
new file mode 100644
index 0000000000..f06591b68f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/address/select.phtml
@@ -0,0 +1,58 @@
+
+
+
__('Change Billing Address') ?>
+ __('Add New Address') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
+ getAddressCollection() as $_address): ?>
+
+
+
+ __('Edit Address') ?> |
+ __('Select Address') ?>
+
+
+ format('html') ?>
+ isAddressDefaultBilling($_address)): ?>
+ __('Default Billing') ?>
+
+ isAddressDefaultShipping($_address)): ?>
+ __('Default Shipping') ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/addresses.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/addresses.phtml
new file mode 100644
index 0000000000..3a62c1dc96
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/addresses.phtml
@@ -0,0 +1,79 @@
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/agreements.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/agreements.phtml
new file mode 100644
index 0000000000..66bebc78b6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/agreements.phtml
@@ -0,0 +1,50 @@
+
+
+
+getAgreements()) return; ?>
+
+getAgreements() as $_a): ?>
+
+ getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>>
+ getIsHtml()):?>
+ getContent() ?>
+
+ htmlEscape($_a->getContent())) ?>
+
+
+
+
+ getCheckboxText()?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/billing.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/billing.phtml
new file mode 100644
index 0000000000..68b6dcaf68
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/billing.phtml
@@ -0,0 +1,102 @@
+
+
+
+
__('Billing Information') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/billing/items.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/billing/items.phtml
new file mode 100644
index 0000000000..c4a5476ad0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/billing/items.phtml
@@ -0,0 +1,54 @@
+
+getQuote()->hasVirtualItems()): ?>
+ __('Other items in your order') ?>
+
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('Qty') ?>
+
+
+
+ getVirtualQuoteItems() as $_item): ?>
+
+ getItemHtml($_item) ?>
+ getQty() ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/item/default.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/item/default.phtml
new file mode 100644
index 0000000000..8d89f82d38
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/item/default.phtml
@@ -0,0 +1,45 @@
+
+
+getOptionList()):?>
+
+
+ getFormatedOptionValue($_option) ?>
+ htmlEscape($_option['label']) ?>
+ class="truncated">
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/link.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/link.phtml
new file mode 100644
index 0000000000..24aaf3ff2d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/link.phtml
@@ -0,0 +1,27 @@
+
+__('Checkout with Multiple Addresses');?>
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/overview.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/overview.phtml
new file mode 100644
index 0000000000..ad3e373dd2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/overview.phtml
@@ -0,0 +1,253 @@
+
+
+
__('Review Order') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/shipping.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/shipping.phtml
new file mode 100644
index 0000000000..b34decaf83
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/shipping.phtml
@@ -0,0 +1,112 @@
+
+
+
+
__('Select Shipping Method') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/state.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/state.phtml
new file mode 100644
index 0000000000..9ca7814797
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/state.phtml
@@ -0,0 +1,38 @@
+
+
+
+getSteps() as $_step): ?>
+ getIsActive()): ?> class="active">getLabel() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/multishipping/success.phtml b/app/design/frontend/default/blank/template/checkout/multishipping/success.phtml
new file mode 100644
index 0000000000..ff7f0a60b0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/multishipping/success.phtml
@@ -0,0 +1,46 @@
+
+
+
__('Order Success') ?>
+
+__('Thank you for your purchase!') ?>
+__('We are processing your order and you will soon receive an email with details of the order. Once the order has shipped you will receive another email with a link to track its progress.') ?>
+getOrderIds()): ?>
+
+ __('Your order number is ') ?>
+ $incrementId): ?>
+
+
+
+
+
+
+
+getChildHtml() ?>
+
+ __('Continue Shopping') ?>
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage.phtml b/app/design/frontend/default/blank/template/checkout/onepage.phtml
new file mode 100644
index 0000000000..8e3e4dfb4b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage.phtml
@@ -0,0 +1,61 @@
+
+
+
__('Checkout') ?>
+
+
+
+
+
+getSteps() as $_stepId => $_stepInfo): ?>
+getChild($_stepId) || !$this->getChild($_stepId)->isShow()): continue; endif; $i++ ?>
+
+
+
+
+
+
+
+ getChildHtml($_stepId) ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/agreements.phtml b/app/design/frontend/default/blank/template/checkout/onepage/agreements.phtml
new file mode 100644
index 0000000000..1dfeca2838
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/agreements.phtml
@@ -0,0 +1,52 @@
+
+
+
+getAgreements()) return; ?>
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/billing.phtml b/app/design/frontend/default/blank/template/checkout/onepage/billing.phtml
new file mode 100644
index 0000000000..a21a2b7930
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/billing.phtml
@@ -0,0 +1,152 @@
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/failure.phtml b/app/design/frontend/default/blank/template/checkout/onepage/failure.phtml
new file mode 100644
index 0000000000..c41dd632e5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/failure.phtml
@@ -0,0 +1,32 @@
+
+
+
__('An error occurred in the process of payment') ?>
+
+getRealOrderId()) : ?>__('Order #') . $this->getRealOrderId() ?>
+getErrorMessage()) : ?>
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/link.phtml b/app/design/frontend/default/blank/template/checkout/onepage/link.phtml
new file mode 100644
index 0000000000..7c245a842d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/link.phtml
@@ -0,0 +1,31 @@
+
+isPossibleOnepageCheckout()):?>
+
+ isDisabled()):?> disabled="disabled" onclick="window.location='getCheckoutUrl() ?>';">__('Proceed to Checkout') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/login.phtml b/app/design/frontend/default/blank/template/checkout/onepage/login.phtml
new file mode 100644
index 0000000000..42f8022a2a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/login.phtml
@@ -0,0 +1,120 @@
+
+
+
+
getQuote()->isAllowedGuestCheckout() ): ?>__('Checkout as a Guest or Register') ?>__('Register to Create an Account') ?>
+ getQuote()->isAllowedGuestCheckout() ): ?>
+
__('Register with us for future convenience:') ?>
+
+
__('Register and save time!') ?>
+ __('Register with us for future convenience:') ?>
+
+ __('Fast and easy check out') ?>
+ __('Easy access to your order history and status') ?>
+
+
+ getQuote()->isAllowedGuestCheckout() ): ?>
+
+
__('Register and save time!') ?>
+ __('Register with us for future convenience:') ?>
+
+ __('Fast and easy check out') ?>
+ __('Easy access to your order history and status') ?>
+
+
+
+
+
+
+
__('Login') ?>
+ getMessagesBlock()->getGroupedHtml() ?>
+
+
+
+
+
+
+
+ getQuote()->isAllowedGuestCheckout() ? $this->__('Continue') : $this->__('Register')) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/payment.phtml b/app/design/frontend/default/blank/template/checkout/onepage/payment.phtml
new file mode 100644
index 0000000000..8219d8ca7b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/payment.phtml
@@ -0,0 +1,70 @@
+
+
+
+
+__('* Required Fields') ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/payment/methods.phtml b/app/design/frontend/default/blank/template/checkout/onepage/payment/methods.phtml
new file mode 100644
index 0000000000..cc68256f1b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/payment/methods.phtml
@@ -0,0 +1,51 @@
+
+
+
+getMethods() as $_method): $_code = $_method->getCode() ?>
+
+ getMethods()) > 1 ): ?>
+ getSelectedMethodCode()==$_code): ?> checked="checked" class="radio" />
+
+
+
+ getTitle() ?>
+
+ getChildHtml('payment.method.'.$_code)) : ?>
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/progress.phtml b/app/design/frontend/default/blank/template/checkout/onepage/progress.phtml
new file mode 100644
index 0000000000..5c13fa396d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/progress.phtml
@@ -0,0 +1,110 @@
+
+
+
+
__('Your Checkout Progress') ?>
+
+
+
+ getCheckout()->getStepData('billing', 'is_show')): ?>
+ getCheckout()->getStepData('billing', 'complete')): ?>
+
+ __('Billing Address') ?> | __('Change') ?>
+
+
+ getBilling()->format('html') ?>
+
+
+
+ __('Billing Address') ?>
+
+
+
+
+ getCheckout()->getStepData('shipping', 'is_show')): ?>
+ getCheckout()->getStepData('shipping', 'complete')): ?>
+
+ __('Shipping Address') ?> | __('Change') ?>
+
+
+ getShipping()->format('html') ?>
+
+
+
+ __('Shipping Address') ?>
+
+
+
+
+ getCheckout()->getStepData('shipping_method', 'is_show')): ?>
+ getCheckout()->getStepData('shipping_method', 'complete')): ?>
+
+ __('Shipping Method') ?> | __('Change') ?>
+
+
+ getShippingMethod()): ?>
+ getShippingDescription() ?>
+
+ getShippingPriceExclTax(); ?>
+ getShippingPriceInclTax(); ?>
+ helper('tax')->displayShippingPriceIncludingTax()): ?>
+
+
+
+
+ helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
+ (__('Incl. Tax'); ?> )
+
+
+
+ __('Shipping method has not been selected yet') ?>
+
+
+
+
+ __('Shipping Method') ?>
+
+
+
+
+ getCheckout()->getStepData('payment', 'is_show')): ?>
+ getCheckout()->getStepData('payment', 'complete')): ?>
+
+ __('Payment Method') ?> | __('Change') ?>
+
+
+ getPaymentHtml() ?>
+
+
+
+ __('Payment Method') ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/review.phtml b/app/design/frontend/default/blank/template/checkout/onepage/review.phtml
new file mode 100644
index 0000000000..c663fcaaf4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/review.phtml
@@ -0,0 +1,42 @@
+
+
+ getChildHtml('info') ?>
+
+getChildHtml('agreements') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/review/info.phtml b/app/design/frontend/default/blank/template/checkout/onepage/review/info.phtml
new file mode 100644
index 0000000000..d8e92d0a89
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/review/info.phtml
@@ -0,0 +1,65 @@
+
+
+ helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
+
+
+
+
+ helper('tax')->displayCartBothPrices()): ?>
+
+
+
+
+
+ __('Product Name') ?>
+ __('Price') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+
+ helper('tax')->getIncExcTaxLabel(false) ?>
+ helper('tax')->getIncExcTaxLabel(true) ?>
+ helper('tax')->getIncExcTaxLabel(false) ?>
+ helper('tax')->getIncExcTaxLabel(true) ?>
+
+
+
+ getChildHtml('totals'); ?>
+
+ getItems() as $_item): ?>
+ getItemHtml($_item)?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/review/item.phtml b/app/design/frontend/default/blank/template/checkout/onepage/review/item.phtml
new file mode 100644
index 0000000000..d54b52cfe1
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/review/item.phtml
@@ -0,0 +1,236 @@
+
+getItem()?>
+
+ htmlEscape($this->getProductName()) ?>
+ getOptionList()):?>
+
+
+ getFormatedOptionValue($_option) ?>
+ htmlEscape($_option['label']) ?>
+ class="truncated">
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
+
+ helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
+
+
+
+
+
+ getApplied($_item)): ?>
+
+
+ typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+
+
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->getPriceInclTax($_item); ?>
+ typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
+
+ helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+
+ typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['amount_incl_tax'],true,true); ?>
+
+
+
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
+
+
+
+
+
+ getQty() ?>
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ helper('checkout')->formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+
+ typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+
+
+
+
+ getApplied($_item)): ?>
+
+
+ typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+
+ typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/review/totals.phtml b/app/design/frontend/default/blank/template/checkout/onepage/review/totals.phtml
new file mode 100644
index 0000000000..9a1e7a1862
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/review/totals.phtml
@@ -0,0 +1,43 @@
+
+getTotals()): ?>
+
+ helper('tax')->displayCartBothPrices() ? 5 : 3; ?>
+ renderTotals(null, $_colspan); ?>
+ renderTotals('footer', $_colspan); ?>
+ needDisplayBaseGrandtotal()):?>
+
+
+ helper('sales')->__('Your credit card will be charged for') ?>
+
+
+ displayBaseGrandtotal() ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/shipping.phtml b/app/design/frontend/default/blank/template/checkout/onepage/shipping.phtml
new file mode 100644
index 0000000000..f8b16ec48a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/shipping.phtml
@@ -0,0 +1,112 @@
+
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/shipping_method.phtml b/app/design/frontend/default/blank/template/checkout/onepage/shipping_method.phtml
new file mode 100644
index 0000000000..0deb403107
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/shipping_method.phtml
@@ -0,0 +1,48 @@
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/shipping_method/additional.phtml b/app/design/frontend/default/blank/template/checkout/onepage/shipping_method/additional.phtml
new file mode 100644
index 0000000000..778bb9d82e
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/shipping_method/additional.phtml
@@ -0,0 +1,27 @@
+
+helper('giftmessage/message')->getInline('onepage_checkout', $this->getQuote(), $this->getDontDisplayContainer()) ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/checkout/onepage/shipping_method/available.phtml b/app/design/frontend/default/blank/template/checkout/onepage/shipping_method/available.phtml
new file mode 100644
index 0000000000..3b2b99e2fb
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/onepage/shipping_method/available.phtml
@@ -0,0 +1,56 @@
+
+getShippingRates())): ?>
+ __('Sorry, no quotes are available for this order at this time.') ?>
+
+
+ $_rates): ?>
+ getCarrierName($code) ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/checkout/success.phtml b/app/design/frontend/default/blank/template/checkout/success.phtml
new file mode 100644
index 0000000000..e11b3252cf
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/success.phtml
@@ -0,0 +1,46 @@
+
+
+
__('Your order has been received') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+__('Thank you for your purchase!') ?>
+canPrint()) :?>
+ __('Your order # is: %s ', $this->getViewOrderUrl(), $this->getOrderId()) ?>.
+
+ __('Your order # is: %s', $this->getOrderId()) ?>.
+
+ __('You will receive an order confirmation email with details of your order and a link to track its progress.') ?>
+canPrint()) :?>
+
+ __('Click here to print a copy of your order confirmation.', $this->getPrintUrl()) ?>
+ getChildHtml() ?>
+
+
+
+ __('Continue Shopping') ?>
+
diff --git a/app/design/frontend/default/blank/template/checkout/total/default.phtml b/app/design/frontend/default/blank/template/checkout/total/default.phtml
new file mode 100644
index 0000000000..5aa7a667c3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/total/default.phtml
@@ -0,0 +1,38 @@
+
+
+
+ getRenderingArea() == $this->getTotal()->getArea()): ?>
+ getTotal()->getTitle() ?>
+ getRenderingArea() == $this->getTotal()->getArea()): ?>
+
+
+ getRenderingArea() == $this->getTotal()->getArea()): ?>
+ helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
+ getRenderingArea() == $this->getTotal()->getArea()): ?>
+
+
diff --git a/app/design/frontend/default/blank/template/checkout/total/tax.phtml b/app/design/frontend/default/blank/template/checkout/total/tax.phtml
new file mode 100644
index 0000000000..02d58aaf5e
--- /dev/null
+++ b/app/design/frontend/default/blank/template/checkout/total/tax.phtml
@@ -0,0 +1,68 @@
+
+
+helper('tax')->displayFullSummary() && $this->getTotal()->getValue()!=0): ?>
+
+ getTotal()->getFullInfo() as $info): ?>
+
+
+
+
+
+
+
+
+
+
+
+ (%)
+
+
+
+
+
+ helper('checkout')->formatPrice($amount); ?>
+
+
+
+
+
+
+
+
+helper('tax')->displayFullSummary() && $this->getTotal()->getValue()!=0): ?> class="tax-total" onclick="expandDetails(this, '.tax-details-')">
+
+ helper('tax')->displayFullSummary()): ?>
+ getTotal()->getTitle() ?>
+
+ getTotal()->getTitle() ?>
+
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/chronopay/form.phtml b/app/design/frontend/default/blank/template/chronopay/form.phtml
new file mode 100644
index 0000000000..a962f0fe27
--- /dev/null
+++ b/app/design/frontend/default/blank/template/chronopay/form.phtml
@@ -0,0 +1,90 @@
+
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/chronopay/info.phtml b/app/design/frontend/default/blank/template/chronopay/info.phtml
new file mode 100644
index 0000000000..d566bab32d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/chronopay/info.phtml
@@ -0,0 +1,35 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/chronopay/standard/failure.phtml b/app/design/frontend/default/blank/template/chronopay/standard/failure.phtml
new file mode 100644
index 0000000000..25b8bfbf06
--- /dev/null
+++ b/app/design/frontend/default/blank/template/chronopay/standard/failure.phtml
@@ -0,0 +1,30 @@
+
+
+
__('Error occured') ?>
+
+__('There was an error occurred during paying process.') ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/chronopay/standard/form.phtml b/app/design/frontend/default/blank/template/chronopay/standard/form.phtml
new file mode 100644
index 0000000000..c3849082c8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/chronopay/standard/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/cms/content.phtml b/app/design/frontend/default/blank/template/cms/content.phtml
new file mode 100644
index 0000000000..5c87320604
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cms/content.phtml
@@ -0,0 +1,27 @@
+
+getPageContent(); ?>
diff --git a/app/design/frontend/default/blank/template/cms/default/home.phtml b/app/design/frontend/default/blank/template/cms/default/home.phtml
new file mode 100644
index 0000000000..8c7695fe7c
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cms/default/home.phtml
@@ -0,0 +1,27 @@
+
+There was no Home CMS page configured or found.
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/cms/default/no-route.phtml b/app/design/frontend/default/blank/template/cms/default/no-route.phtml
new file mode 100644
index 0000000000..30669493b5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cms/default/no-route.phtml
@@ -0,0 +1,27 @@
+
+There was no 404 CMS page configured or found.
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/cms/meta.phtml b/app/design/frontend/default/blank/template/cms/meta.phtml
new file mode 100644
index 0000000000..fbf6bd9743
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cms/meta.phtml
@@ -0,0 +1,32 @@
+
+getPageMetaKeywords()): ?>
+
+
+getPageMetaDescription()): ?>
+
+
diff --git a/app/design/frontend/default/blank/template/cms/wrapper.phtml b/app/design/frontend/default/blank/template/cms/wrapper.phtml
new file mode 100644
index 0000000000..e9954f0bc4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cms/wrapper.phtml
@@ -0,0 +1,29 @@
+
+
+ getChildHtml(); ?>
+
diff --git a/app/design/frontend/default/blank/template/contacts/form.phtml b/app/design/frontend/default/blank/template/contacts/form.phtml
new file mode 100644
index 0000000000..be10570419
--- /dev/null
+++ b/app/design/frontend/default/blank/template/contacts/form.phtml
@@ -0,0 +1,67 @@
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
__('Contact Us') ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/core/formkey.phtml b/app/design/frontend/default/blank/template/core/formkey.phtml
new file mode 100644
index 0000000000..8eac56b056
--- /dev/null
+++ b/app/design/frontend/default/blank/template/core/formkey.phtml
@@ -0,0 +1,27 @@
+
+
diff --git a/app/design/frontend/default/blank/template/core/messages.phtml b/app/design/frontend/default/blank/template/core/messages.phtml
new file mode 100644
index 0000000000..3e9c0e6dc2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/core/messages.phtml
@@ -0,0 +1,47 @@
+
+getMessages($type) ) {
+ if ( !$html ) {
+ $html .= '';
+ }
+ $html .= '';
+ $html .= '';
+
+ foreach ( $messages as $message ) {
+ $html.= '';
+ $html.= $message->getText();
+ $html.= ' ';
+ }
+ $html .= ' ';
+ $html .= ' ';
+ }
+ }
+ if ( $html) {
+ $html .= ' ';
+ }
+?>
diff --git a/app/design/frontend/default/blank/template/customer/account/dashboard.phtml b/app/design/frontend/default/blank/template/customer/account/dashboard.phtml
new file mode 100644
index 0000000000..ab8e4f6f32
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/account/dashboard.phtml
@@ -0,0 +1,39 @@
+
+
+
__('My Dashboard') ?>
+
+
+ getMessagesBlock()->getGroupedHtml() ?>
+ getChildHtml('hello') ?>
+ getChildHtml('top') ?>
+
__('Account Information') ?>
+ getChildHtml('info') ?>
+ getChildHtml('address') ?>
+ getChildHtml('info1') ?>
+ getChildHtml('info2') ?>
+
diff --git a/app/design/frontend/default/blank/template/customer/account/dashboard/address.phtml b/app/design/frontend/default/blank/template/customer/account/dashboard/address.phtml
new file mode 100644
index 0000000000..c3dc06411c
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/account/dashboard/address.phtml
@@ -0,0 +1,44 @@
+
+
diff --git a/app/design/frontend/default/blank/template/customer/account/dashboard/hello.phtml b/app/design/frontend/default/blank/template/customer/account/dashboard/hello.phtml
new file mode 100644
index 0000000000..8a7f47e3e8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/account/dashboard/hello.phtml
@@ -0,0 +1,30 @@
+
+
+
__('Hello, %s!', $this->htmlEscape($this->getCustomerName())) ?>
+
__('From your My Account Dashboard you have the ability to view a snapshot of your recent account activity and update your account information. Select a link below to view or edit information.') ?>
+
diff --git a/app/design/frontend/default/blank/template/customer/account/dashboard/info.phtml b/app/design/frontend/default/blank/template/customer/account/dashboard/info.phtml
new file mode 100644
index 0000000000..b8b78595c1
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/account/dashboard/info.phtml
@@ -0,0 +1,50 @@
+
+
+
+ isNewsletterEnabled() ): ?>
+
+
__('Newsletters') ?>
+
__('Edit') ?>
+
+ getIsSubscribed() ): ?>
+ __("You are currently subscribed to 'General Subscription'.") ?>
+
+ __('You are currently not subscribed to any newsletter.') ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/customer/account/dashboard/newsletter.phtml b/app/design/frontend/default/blank/template/customer/account/dashboard/newsletter.phtml
new file mode 100644
index 0000000000..e2b117fed8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/account/dashboard/newsletter.phtml
@@ -0,0 +1,31 @@
+
+
diff --git a/app/design/frontend/default/blank/template/customer/account/dashboard/sidebar.phtml b/app/design/frontend/default/blank/template/customer/account/dashboard/sidebar.phtml
new file mode 100644
index 0000000000..ecbe3473a8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/account/dashboard/sidebar.phtml
@@ -0,0 +1,26 @@
+
diff --git a/app/design/frontend/default/blank/template/customer/account/link/back.phtml b/app/design/frontend/default/blank/template/customer/account/link/back.phtml
new file mode 100644
index 0000000000..c27876680f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/account/link/back.phtml
@@ -0,0 +1,29 @@
+
+
diff --git a/app/design/frontend/default/blank/template/customer/account/navigation.phtml b/app/design/frontend/default/blank/template/customer/account/navigation.phtml
new file mode 100644
index 0000000000..9f1ead682b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/account/navigation.phtml
@@ -0,0 +1,46 @@
+
+
+
+
__('My Account'); ?>
+
+
+
+ getLinks(); ?>
+
+
+
+ = $_count); ?>
+ isActive($_link)): ?>
+ getLabel() ?>
+
+ >getLabel() ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/customer/address.phtml b/app/design/frontend/default/blank/template/customer/address.phtml
new file mode 100644
index 0000000000..bc467495f2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/address.phtml
@@ -0,0 +1,94 @@
+
+
+
Address Book
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
+ Primary
+
+
+
+
+
+
+ format('html') ?>
+
+
+ __('Edit Address') ?>
+
+
+
+
+
+
+
+ __('You have no primary entries in your address book.') ?>
+
+
+
+
+
+ __('Additional Address Entries') ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/customer/address/book.phtml b/app/design/frontend/default/blank/template/customer/address/book.phtml
new file mode 100644
index 0000000000..a4d5988f0a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/address/book.phtml
@@ -0,0 +1,117 @@
+
+
+
+
__('Address Book') ?>
+ __('Add New Address') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
+
__('Default Addresses') ?>
+
+ getCustomer()->getDefaultBilling()): ?>
+
+ __('Default Billing Address') ?>
+
+ getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
+ __('Change Billing Address') ?>
+
+ getCustomer()->getDefaultShipping()): ?>
+
+ __('Default Billing Address') ?>
+
+ getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
+ __('Change Billing Address') ?>
+
+
+
+
+ __('Default Billing Address') ?>
+ __('You have no default billing address in your address book.') ?>
+
+ getCustomer()->getDefaultShipping()): ?>
+
+ __('Default Shipping Address') ?>
+
+ getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
+ __('Change Shipping Address') ?>
+
+
+ getCustomer()->getDefaultBilling()): ?>
+
+ __('Default Shipping Address') ?>
+
+ getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
+ __('Change Shipping Address') ?>
+
+
+
+
+ __('Default Shipping Address') ?> __('You have no default shipping address in your address book.') ?>
+
+
+
+
+
+
__('Additional Address Entries') ?>
+
+ getAdditionalAddresses()): ?>
+
+
+
+ getAddressHtml($_address) ?>
+ __('Edit Address') ?>
+ |
+ __('Delete Address') ?>
+
+
+
+
+ __('You have no additional address entries in your address book.') ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/customer/address/edit.phtml b/app/design/frontend/default/blank/template/customer/address/edit.phtml
new file mode 100644
index 0000000000..0a43ce3abf
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/address/edit.phtml
@@ -0,0 +1,137 @@
+
+
+getTitle()): ?>
+
+
getTitle() ?>
+
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/customer/balance.phtml b/app/design/frontend/default/blank/template/customer/balance.phtml
new file mode 100644
index 0000000000..fabbd6da8e
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/balance.phtml
@@ -0,0 +1,31 @@
+
+getMessagesBlock()->getGroupedHtml() ?>
+__('Your account balance is: %s', $customer->getStoreBalance()) ?>
+
diff --git a/app/design/frontend/default/blank/template/customer/form/address.phtml b/app/design/frontend/default/blank/template/customer/form/address.phtml
new file mode 100644
index 0000000000..4874cdbbd6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/address.phtml
@@ -0,0 +1,123 @@
+
+
+
+
+
getAddressId()): ?>__('Edit Address Entry') ?>__('New Address Entry') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/customer/form/changepassword.phtml b/app/design/frontend/default/blank/template/customer/form/changepassword.phtml
new file mode 100644
index 0000000000..31a11e01bc
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/changepassword.phtml
@@ -0,0 +1,60 @@
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/customer/form/confirmation.phtml b/app/design/frontend/default/blank/template/customer/form/confirmation.phtml
new file mode 100644
index 0000000000..99191b4851
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/confirmation.phtml
@@ -0,0 +1,51 @@
+
+
+
__('Send confirmation link') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/customer/form/edit.phtml b/app/design/frontend/default/blank/template/customer/form/edit.phtml
new file mode 100644
index 0000000000..0c6265151b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/edit.phtml
@@ -0,0 +1,106 @@
+
+
+
__('Edit Account Information') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/customer/form/forgotpassword.phtml b/app/design/frontend/default/blank/template/customer/form/forgotpassword.phtml
new file mode 100644
index 0000000000..621a6b93f4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/forgotpassword.phtml
@@ -0,0 +1,54 @@
+
+
+
__('Forgot Your Password?') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/customer/form/login.phtml b/app/design/frontend/default/blank/template/customer/form/login.phtml
new file mode 100644
index 0000000000..b3f0c6f791
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/login.phtml
@@ -0,0 +1,83 @@
+
+
+
+
+
__('Login or Create an Account') ?>
+
+ getMessagesBlock()->getGroupedHtml() ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/customer/form/mini.login.phtml b/app/design/frontend/default/blank/template/customer/form/mini.login.phtml
new file mode 100644
index 0000000000..bbcf699a75
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/mini.login.phtml
@@ -0,0 +1,33 @@
+
+
diff --git a/app/design/frontend/default/blank/template/customer/form/newsletter.phtml b/app/design/frontend/default/blank/template/customer/form/newsletter.phtml
new file mode 100644
index 0000000000..08192383eb
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/newsletter.phtml
@@ -0,0 +1,47 @@
+
+
+
__('Newsletter Subscription') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/customer/form/register.phtml b/app/design/frontend/default/blank/template/customer/form/register.phtml
new file mode 100644
index 0000000000..187580b102
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/form/register.phtml
@@ -0,0 +1,154 @@
+
+
+
+
+
__('Create an Account') ?>
+
+ getMessagesBlock()->getGroupedHtml() ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/customer/logout.phtml b/app/design/frontend/default/blank/template/customer/logout.phtml
new file mode 100644
index 0000000000..df1fa3985a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/logout.phtml
@@ -0,0 +1,35 @@
+
+
+
__("You're now Logged Out") ?>
+
+__('You have been successfully logged out and will be redirected to our homepage in 5 seconds.') ?>
+
diff --git a/app/design/frontend/default/blank/template/customer/order/view.phtml b/app/design/frontend/default/blank/template/customer/order/view.phtml
new file mode 100644
index 0000000000..2f1691b463
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/order/view.phtml
@@ -0,0 +1,85 @@
+
+
+
__('Order #%s (%s)', $order->getOrderId(), $order->getStatus()) ?>
+
+
+
+
__('Billing Information') ?>
+
+ getAddressByType('billing')->format('html') ?>
+
+
+
+
__('Payment Method') ?>
+ getChildHtml('payment') ?>
+
+
+
+
+
__('Shipping Information') ?>
+
+ getAddressByType('shipping')->format('html') ?>
+
+
+
+
__('Shipping Method') ?>
+ getShippingDescription() ?>
+
+
+getEntitiesByType('item') ?>
+
+
+
+ __('Items Order') ?>
+ __('Qty') ?>
+ __('Price') ?>
+ __('Ext. Price') ?>
+
+
+
+
+
+ __('Grand Total: %s', $order->getGrandTotal()) ?>
+
+
+
+
+
+
+ htmlEscape($_item->getName()) ?>
+ getQty() ?>
+ getPrice() ?>
+ getRowTotal() ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/customer/orders.phtml b/app/design/frontend/default/blank/template/customer/orders.phtml
new file mode 100644
index 0000000000..dd6ce2ccc2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/orders.phtml
@@ -0,0 +1,61 @@
+
+
+
__('My Orders') ?>
+
+getSize()): ?>
+
+
+
+ __('Order #') ?>
+ __('Date') ?>
+
+ __('Total') ?>
+ __('Status') ?>
+ __('Details') ?>
+
+
+
+
+
+ getRealOrderId() ?>
+ getCreatedAt())) ?>
+
+ getGrandTotal() ?>
+ getStatus() ?>
+ __('View Order') ?>
+
+
+
+
+
+
+ __('You have placed no orders yet.') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/customer/widget/dob.phtml b/app/design/frontend/default/blank/template/customer/widget/dob.phtml
new file mode 100644
index 0000000000..f17be6ff06
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/widget/dob.phtml
@@ -0,0 +1,79 @@
+getLayout()->createBlock('customer/widget_dob')
+ ->setDate($this->getCustomer()->getDob())
+ ->toHtml() ?>
+
+For checkout/onepage/billing.phtml:
+
+getLayout()->createBlock('customer/widget_dob')
+ ->setDate($this->getCustomer()->getDob())
+ ->setFieldIdFormat('billing:%s')
+ ->setFieldNameFormat('billing[%s]')
+ ->toHtml() ?>
+
+NOTE: Regarding styles - if we leave it this way, we'll move it to boxes.css
+ Alternatively we could calculate widths automatically using block input parameters.
+*/
+?>
+
+
+ __('Date of Birth') ?>
+ isRequired()):?>*
+
+
+
+ getFieldParams() ?> />
+ __('DD') ?>
+
+
+
+ getFieldParams() ?> />
+ __('MM') ?>
+
+
+
+ getFieldParams() ?> />
+ __('YYYY') ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/customer/widget/name.phtml b/app/design/frontend/default/blank/template/customer/widget/name.phtml
new file mode 100644
index 0000000000..f0b5a904af
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/widget/name.phtml
@@ -0,0 +1,113 @@
+getLayout()->createBlock('customer/widget_name')
+ ->setObject($this->getAddress())
+ ->toHtml() ?>
+
+For checkout/onepage/shipping.phtml:
+
+getLayout()->createBlock('customer/widget_name')
+ ->setObject($this->getAddress())
+ ->setFieldIdFormat('shipping:%s')
+ ->setFieldNameFormat('shipping[%s]')
+ ->setFieldParams('onchange="shipping.setSameAsBilling(false);"')
+ ->toHtml() ?>
+*/
+?>
+
+
diff --git a/app/design/frontend/default/blank/template/customer/widget/taxvat.phtml b/app/design/frontend/default/blank/template/customer/widget/taxvat.phtml
new file mode 100644
index 0000000000..5e6f9b83ee
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/widget/taxvat.phtml
@@ -0,0 +1,33 @@
+
+
+
+ __('Tax/VAT number') ?>
+ isRequired()):?>*
+
+ getFieldParams() ?> />
+
diff --git a/app/design/frontend/default/blank/template/customer/wishlist.phtml b/app/design/frontend/default/blank/template/customer/wishlist.phtml
new file mode 100644
index 0000000000..85b28aece8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/customer/wishlist.phtml
@@ -0,0 +1,67 @@
+
+
+
__('Wishlist') ?>
+
+getSize()): ?>
+
+
+ __('You have placed no products yet.') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/cybermut/error.phtml b/app/design/frontend/default/blank/template/cybermut/error.phtml
new file mode 100644
index 0000000000..f11eb3a6e3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cybermut/error.phtml
@@ -0,0 +1,30 @@
+
+
+
__('Error occured') ?>
+
+__('There was an error occurred during paying process.') ?>
diff --git a/app/design/frontend/default/blank/template/cybermut/form.phtml b/app/design/frontend/default/blank/template/cybermut/form.phtml
new file mode 100644
index 0000000000..df20f3d195
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cybermut/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/cybersource/form.phtml b/app/design/frontend/default/blank/template/cybersource/form.phtml
new file mode 100644
index 0000000000..ca554f0c99
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cybersource/form.phtml
@@ -0,0 +1,177 @@
+
+getMethodCode() ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/cybersource/info.phtml b/app/design/frontend/default/blank/template/cybersource/info.phtml
new file mode 100644
index 0000000000..1a816388e8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/cybersource/info.phtml
@@ -0,0 +1,39 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+
+__('Credit Card Type: %s', $this->getCcTypeName()) ?>
+__('Credit Card Number: xxxx-%s', $this->getInfo()->getCcLast4()) ?>
+__('Expiration Date: %s/%s', $this->getCcExpMonth(), $this->getInfo()->getCcExpYear()) ?>
+getInfo()->getCcSsIssue()): ?>
+__("Switch/Solo/Maestro(UK Domestic) card issue number: %s", $this->getInfo()->getCcSsIssue()) ?>
+
+getInfo()->getCcSsStartYear()): ?>
+__('Switch/Solo/Maestro(UK Domestic) card start Date: %s/%s', $this->getCcStartMonth(), $this->getInfo()->getCcSsStartYear()) ?>
+
+
diff --git a/app/design/frontend/default/blank/template/directory/currency.phtml b/app/design/frontend/default/blank/template/directory/currency.phtml
new file mode 100644
index 0000000000..2cfda7c8a2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/directory/currency.phtml
@@ -0,0 +1,58 @@
+
+
+getCurrencyCount()>1): ?>
+
+
+
__('Select Your Currency') ?>
+
+
+
+ getCurrencies() as $_code => $_name): ?>
+ getCurrentCurrencyCode()): ?> selected="selected">
+ -
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/directory/currency/switch.phtml b/app/design/frontend/default/blank/template/directory/currency/switch.phtml
new file mode 100644
index 0000000000..e2d8f214be
--- /dev/null
+++ b/app/design/frontend/default/blank/template/directory/currency/switch.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Currency') ?>
+
+__('Your current currency is: %s', $currency->getCode()) ?>
+__('Continue »') ?>
diff --git a/app/design/frontend/default/blank/template/downloadable/catalog/product/links.phtml b/app/design/frontend/default/blank/template/downloadable/catalog/product/links.phtml
new file mode 100644
index 0000000000..a103287194
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/catalog/product/links.phtml
@@ -0,0 +1,115 @@
+
+getLinksPurchasedSeparately() ?>
+getProduct()->isSaleable() && $this->hasLinks()):?>
+
+ getLinks(); ?>
+ getLinkSelectionRequired(); ?>
+ getLinksTitle() ?> *
+ decoratedIsLast){?> class="last">
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/downloadable/catalog/product/samples.phtml b/app/design/frontend/default/blank/template/downloadable/catalog/product/samples.phtml
new file mode 100644
index 0000000000..e3774c21b2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/catalog/product/samples.phtml
@@ -0,0 +1,45 @@
+
+
+hasSamples()): ?>
+
+ getSamplesTitle() ?>
+ getSamples() ?>
+
+
+ getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>>getTitle() ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/downloadable/catalog/product/type.phtml b/app/design/frontend/default/blank/template/downloadable/catalog/product/type.phtml
new file mode 100644
index 0000000000..b32104a22f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/catalog/product/type.phtml
@@ -0,0 +1,41 @@
+
+getProduct() ?>
+
+isSaleable()): ?>
+ __('Availability') ?>: __('In stock') ?>
+
+ __('Availability') ?>: __('Out of stock') ?>
+
+getPriceHtml($_product) ?>
+getChildHtml('samples') ?>
diff --git a/app/design/frontend/default/blank/template/downloadable/checkout/cart/item/default.phtml b/app/design/frontend/default/blank/template/downloadable/checkout/cart/item/default.phtml
new file mode 100644
index 0000000000..bf9131d633
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/checkout/cart/item/default.phtml
@@ -0,0 +1,98 @@
+
+getItem()?>
+
+
+
+
+
+ getOptionList()):?>
+
+
+ getFormatedOptionValue($_option) ?>
+ htmlEscape($_option['label']) ?>
+ class="truncated">
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+
+
+
+ getLinks()): ?>
+
+ getLinksTitle() ?>
+
+ getTitle() ?>
+
+
+
+
+
+ getMessages()): ?>
+
+
+ *
+
+
+
+
+ helper('wishlist')->isAllowInCart()) : ?>
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item)); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($_item->getRowTotal()) ?>
+
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+
+ helper('checkout')->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item)); ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/downloadable/checkout/multishipping/item/downloadable.phtml b/app/design/frontend/default/blank/template/downloadable/checkout/multishipping/item/downloadable.phtml
new file mode 100644
index 0000000000..967d936cd5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/checkout/multishipping/item/downloadable.phtml
@@ -0,0 +1,57 @@
+
+
+
+getOptionList()):?>
+
+
+ getFormatedOptionValue($_option) ?>
+ htmlEscape($_option['label']) ?>
+ class="truncated">
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+
+
+
+
+ getLinks()): ?>
+
+ getLinksTitle() ?>
+
+ getTitle() ?>
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/downloadable/checkout/onepage/review/item.phtml b/app/design/frontend/default/blank/template/downloadable/checkout/onepage/review/item.phtml
new file mode 100644
index 0000000000..e7a0fc9485
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/checkout/onepage/review/item.phtml
@@ -0,0 +1,72 @@
+
+getItem()?>
+
+ htmlEscape($this->getProductName()) ?>
+
+ getOptionList()):?>
+
+
+ getFormatedOptionValue($_option) ?>
+ htmlEscape($_option['label']) ?>
+ class="truncated">
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+
+
+ getLinks()): ?>
+
+ getLinksTitle() ?>
+
+ getTitle() ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+ helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+ helper('checkout')->formatPrice($this->helper('checkout')->getPriceInclTax($_item)); ?>
+
+ getQty() ?>
+ helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+ helper('checkout')->formatPrice($_item->getRowTotal()) ?>
+
+ helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
+ helper('checkout')->formatPrice($this->helper('checkout')->getSubtotalInclTax($_item)); ?>
+
+
diff --git a/app/design/frontend/default/blank/template/downloadable/checkout/success.phtml b/app/design/frontend/default/blank/template/downloadable/checkout/success.phtml
new file mode 100644
index 0000000000..fde9e95b76
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/checkout/success.phtml
@@ -0,0 +1,29 @@
+
+getOrderHasDownloadable()): ?>
+__('Go to My Downloadable Products ', $this->getDownloadableProductsUrl()) ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/downloadable/customer/products/list.phtml b/app/design/frontend/default/blank/template/downloadable/customer/products/list.phtml
new file mode 100644
index 0000000000..2aa45d4bb9
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/customer/products/list.phtml
@@ -0,0 +1,74 @@
+
+
+getMessagesBlock()->getGroupedHtml() ?>
+getItems(); ?>
+
+
__('My Downloadable Products') ?>
+
+getChildHtml('pager'); ?>
+
+
+
+
+ __('You have not purchased any downloadable products yet.'); ?>
+
+getChildHtml('pager'); ?>
+
diff --git a/app/design/frontend/default/blank/template/downloadable/email/order/items/creditmemo/downloadable.phtml b/app/design/frontend/default/blank/template/downloadable/email/order/items/creditmemo/downloadable.phtml
new file mode 100644
index 0000000000..44977adefa
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/email/order/items/creditmemo/downloadable.phtml
@@ -0,0 +1,128 @@
+
+getItem() ?>
+getItem()->getOrder(); ?>
+
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getLinks()->getPurchasedItems()): ?>
+
+ getLinksTitle() ?>
+
+ getLinkTitle() ?>
+
+
+
+ getDescription() ?>
+
+ getSku($_item) ?>
+ getQty()*1 ?>
+
+ helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/downloadable/email/order/items/invoice/downloadable.phtml b/app/design/frontend/default/blank/template/downloadable/email/order/items/invoice/downloadable.phtml
new file mode 100644
index 0000000000..4d40824e16
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/email/order/items/invoice/downloadable.phtml
@@ -0,0 +1,131 @@
+
+getItem() ?>
+getItem()->getOrder(); ?>
+
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getLinks()->getPurchasedItems()): ?>
+
+ getLinksTitle() ?>
+
+
+ getLinkTitle() ?>
+ (__('download') ?> )
+
+
+
+
+ getDescription() ?>
+
+ getSku($_item) ?>
+ getQty()*1 ?>
+
+ helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/downloadable/email/order/items/order/downloadable.phtml b/app/design/frontend/default/blank/template/downloadable/email/order/items/order/downloadable.phtml
new file mode 100644
index 0000000000..c41d10ad0e
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/email/order/items/order/downloadable.phtml
@@ -0,0 +1,137 @@
+
+getItem() ?>
+getItem()->getOrder() ?>
+
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getLinks()->getPurchasedItems()): ?>
+
+ getLinksTitle() ?>
+
+
+ getLinkTitle() ?>
+ (__('download') ?> )
+
+
+
+
+ getDescription() ?>
+ getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_item->getGiftMessageId())): ?>
+ __('Gift Message') ?>
+ __('From:'); ?> htmlEscape($_giftMessage->getSender()) ?>
+ __('To:'); ?> htmlEscape($_giftMessage->getRecipient()) ?>
+ __('Message:'); ?> htmlEscape($_giftMessage->getMessage()) ?>
+
+
+ getSku($_item) ?>
+ getQtyOrdered()*1 ?>
+
+ helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml b/app/design/frontend/default/blank/template/downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml
new file mode 100644
index 0000000000..407dbfd5b3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/sales/order/creditmemo/items/renderer/downloadable.phtml
@@ -0,0 +1,112 @@
+
+getItem() ?>
+getItem()->getOrderItem()->getOrder() ?>
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+
+
+ getLinks()): ?>
+
+ getLinksTitle() ?>
+ getPurchasedItems() as $link): ?>
+ getLinkTitle() ?>
+
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item->getOrderItem()) && $_item->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+ splitInjection($this->getSku()) ?>
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Excl. Tax'); ?>:
+
+ formatPrice($_item->getPrice()) ?>
+
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Incl. Tax'); ?>:
+
+ formatPrice($this->helper('checkout')->getPriceInclTax($_item)); ?>
+
+
+
+ getQty()*1 ?>
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Excl. Tax'); ?>:
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Incl. Tax'); ?>:
+
+ formatPrice($this->helper('checkout')->getSubtotalInclTax($_item)); ?>
+
+
+
+ formatPrice(-$_item->getDiscountAmount()) ?>
+
+ formatPrice($_item->getRowTotal()-$_item->getDiscountAmount()+$_item->getTaxAmount()) ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/downloadable/sales/order/invoice/items/renderer/downloadable.phtml b/app/design/frontend/default/blank/template/downloadable/sales/order/invoice/items/renderer/downloadable.phtml
new file mode 100644
index 0000000000..e89f2433f4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/sales/order/invoice/items/renderer/downloadable.phtml
@@ -0,0 +1,109 @@
+
+getItem() ?>
+getItem()->getOrderItem()->getOrder() ?>
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+
+
+ getLinks()): ?>
+
+ getLinksTitle() ?>
+ getPurchasedItems() as $link): ?>
+ getLinkTitle() ?>
+
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item->getOrderItem()) && $_item->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+ splitInjection($this->getSku()) ?>
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Excl. Tax'); ?>:
+
+ formatPrice($_item->getPrice()) ?>
+
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Incl. Tax'); ?>:
+
+ formatPrice($this->helper('checkout')->getPriceInclTax($_item)); ?>
+
+
+
+ getQty()*1 ?>
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Excl. Tax'); ?>:
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Incl. Tax'); ?>:
+
+ formatPrice($this->helper('checkout')->getSubtotalInclTax($_item)); ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/downloadable/sales/order/items/renderer/downloadable.phtml b/app/design/frontend/default/blank/template/downloadable/sales/order/items/renderer/downloadable.phtml
new file mode 100644
index 0000000000..7f2b6efece
--- /dev/null
+++ b/app/design/frontend/default/blank/template/downloadable/sales/order/items/renderer/downloadable.phtml
@@ -0,0 +1,131 @@
+
+getItem() ?>
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+
+
+ getLinks()): ?>
+
+ getLinksTitle() ?>
+ getPurchasedItems() as $link): ?>
+ getLinkTitle() ?>
+
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+ splitInjection($this->getSku()) ?>
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Excl. Tax'); ?>:
+
+ getOrder()->formatPrice($this->getItem()->getPrice()) ?>
+
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Incl. Tax'); ?>:
+
+ getOrder()->formatPrice($this->helper('checkout')->getPriceInclTax($this->getItem())); ?>
+
+
+
+
+
+ getItem()->getQtyOrdered() > 0): ?>
+ __('Ordered'); ?>: getItem()->getQtyOrdered()*1 ?>
+
+ getItem()->getQtyShipped() > 0): ?>
+ __('Shipped'); ?>: getItem()->getQtyShipped()*1 ?>
+
+ getItem()->getQtyCanceled() > 0): ?>
+ __('Canceled'); ?>: getItem()->getQtyCanceled()*1 ?>
+
+ getItem()->getQtyRefunded() > 0): ?>
+ __('Refunded'); ?>: getItem()->getQtyRefunded()*1 ?>
+
+
+
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Excl. Tax'); ?>:
+
+ getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
+
+
+ helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+
+ helper('tax')->displayCartBothPrices()): ?>
+ __('Incl. Tax'); ?>:
+
+ getOrder()->formatPrice($this->helper('checkout')->getSubtotalInclTax($this->getItem())); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/creditmemo/items.phtml b/app/design/frontend/default/blank/template/email/order/creditmemo/items.phtml
new file mode 100644
index 0000000000..b44dfcdede
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/creditmemo/items.phtml
@@ -0,0 +1,51 @@
+
+getCreditmemo() ?>
+getOrder() ?>
+
+
+
+
+ __('Item') ?>
+ __('Sku') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+
+
+
+ getAllItems() as $_item): ?>
+ getOrderItem()->getParentItem()) continue; else $i++; ?>
+ >
+ getItemHtml($_item) ?>
+
+
+
+
+ getChildHtml('creditmemo_totals');?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/invoice/items.phtml b/app/design/frontend/default/blank/template/email/order/invoice/items.phtml
new file mode 100644
index 0000000000..c70f2c8f36
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/invoice/items.phtml
@@ -0,0 +1,51 @@
+
+getInvoice() ?>
+getOrder() ?>
+
+
+
+
+ __('Item') ?>
+ __('Sku') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+
+
+
+ getAllItems() as $_item): ?>
+ getOrderItem()->getParentItem()) continue; else $i++; ?>
+ >
+ getItemHtml($_item) ?>
+
+
+
+
+ getChildHtml('invoice_totals')?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/items.phtml b/app/design/frontend/default/blank/template/email/order/items.phtml
new file mode 100644
index 0000000000..6415c09de5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/items.phtml
@@ -0,0 +1,59 @@
+
+getOrder() ?>
+
+
+
+ __('Item') ?>
+ __('Sku') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+
+
+
+ getAllItems() as $_item): ?>
+ getParentItem()) continue; else $i++; ?>
+ >
+ getItemHtml($_item) ?>
+
+
+
+
+ getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_order->getGiftMessageId())): ?>
+
+
+ __('Gift Message') ?>
+ __('From:'); ?> htmlEscape($_giftMessage->getSender()) ?>
+ __('To:'); ?> htmlEscape($_giftMessage->getRecipient()) ?>
+ __('Message:'); ?> htmlEscape($_giftMessage->getMessage()) ?>
+
+
+
+ getChildHtml('order_totals') ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/items/creditmemo/default.phtml b/app/design/frontend/default/blank/template/email/order/items/creditmemo/default.phtml
new file mode 100644
index 0000000000..eddaaba5e0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/items/creditmemo/default.phtml
@@ -0,0 +1,120 @@
+
+getItem() ?>
+getItem()->getOrder(); ?>
+
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getDescription() ?>
+
+ getSku($_item) ?>
+ getQty()*1 ?>
+
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/items/invoice/default.phtml b/app/design/frontend/default/blank/template/email/order/items/invoice/default.phtml
new file mode 100644
index 0000000000..eddaaba5e0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/items/invoice/default.phtml
@@ -0,0 +1,120 @@
+
+getItem() ?>
+getItem()->getOrder(); ?>
+
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getDescription() ?>
+
+ getSku($_item) ?>
+ getQty()*1 ?>
+
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/items/order/default.phtml b/app/design/frontend/default/blank/template/email/order/items/order/default.phtml
new file mode 100644
index 0000000000..4eead06312
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/items/order/default.phtml
@@ -0,0 +1,126 @@
+
+getItem() ?>
+getItem()->getOrder() ?>
+
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getDescription() ?>
+ getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_item->getGiftMessageId())): ?>
+ __('Gift Message') ?>
+ __('From:'); ?> htmlEscape($_giftMessage->getSender()) ?>
+ __('To:'); ?> htmlEscape($_giftMessage->getRecipient()) ?>
+ __('Message:'); ?> htmlEscape($_giftMessage->getMessage()) ?>
+
+
+ getSku($_item) ?>
+ getQtyOrdered()*1 ?>
+
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Excl. Tax'); ?>:
+
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+
+ __('Total'); ?>: formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ __('Incl. Tax'); ?>:
+
+ helper('checkout')->getSubtotalInclTax($_item); ?>
+ typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
+ formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+ formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
+
+ getApplied($_item)): ?>
+
+ typeOfDisplay($_item, 1, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount'],true,true); ?>
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+ typeOfDisplay($_item, 4, 'email', $_order->getStore())): ?>
+
+ getApplied($_item) as $tax): ?>
+ : formatPrice($tax['row_amount_incl_tax'],true,true); ?>
+
+
+
+
+ typeOfDisplay($_item, 2, 'email', $_order->getStore())): ?>
+ __('Total incl. tax'); ?>: formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/items/shipment/default.phtml b/app/design/frontend/default/blank/template/email/order/items/shipment/default.phtml
new file mode 100644
index 0000000000..a0ae03f53e
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/items/shipment/default.phtml
@@ -0,0 +1,43 @@
+
+getItem() ?>
+
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+ getItemOptions() as $option): ?>
+
+
+
+
+
+ getDescription() ?>
+
+ getSku($_item) ?>
+ getQty()*1 ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/shipment/items.phtml b/app/design/frontend/default/blank/template/email/order/shipment/items.phtml
new file mode 100644
index 0000000000..7677500f25
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/shipment/items.phtml
@@ -0,0 +1,47 @@
+
+getShipment() ?>
+getOrder() ?>
+
+
+
+
+ __('Item') ?>
+ __('Sku') ?>
+ __('Qty') ?>
+
+
+
+ getAllItems() as $_item): ?>
+ getOrderItem()->getParentItem()) continue; else $i++; ?>
+ >
+ getItemHtml($_item) ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/order/shipment/track.phtml b/app/design/frontend/default/blank/template/email/order/shipment/track.phtml
new file mode 100644
index 0000000000..915d9c6c8a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/order/shipment/track.phtml
@@ -0,0 +1,46 @@
+
+getShipment() ?>
+getOrder() ?>
+getAllTracks()): ?>
+
+
+
+ __('Shipped By') ?>
+ __('Tracking Number') ?>
+
+
+
+ getAllTracks() as $_item): $i++ ?>
+ >
+ getTitle() ?>
+ getNumber() ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/email/productalert/price.phtml b/app/design/frontend/default/blank/template/email/productalert/price.phtml
new file mode 100644
index 0000000000..d88202cce3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/productalert/price.phtml
@@ -0,0 +1,50 @@
+
+getProducts()): ?>
+__('You are receiving this notification because you subscribed to receive alerts when the prices for the following products changed:') ?>
+
+
+
+
+
+
+ getShortDescription()): ?>
+
+
+ getPrice() != $_product->getFinalPrice()): ?>
+ __('Regular Price:') ?> formatPrice($_product->getPrice()) ?>
+ __('Special price:') ?> formatPrice($_product->getFinalPrice()) ?>
+
+ __('Price:') ?> formatPrice($_product->getPrice()) ?>
+
+ __('Click here not to receive alerts for this product') ?>
+
+
+
+
+__('Unsubscribe from all price alerts') ?>
+
diff --git a/app/design/frontend/default/blank/template/email/productalert/stock.phtml b/app/design/frontend/default/blank/template/email/productalert/stock.phtml
new file mode 100644
index 0000000000..05f42bce34
--- /dev/null
+++ b/app/design/frontend/default/blank/template/email/productalert/stock.phtml
@@ -0,0 +1,50 @@
+
+getProducts()): ?>
+__('You are receiving this notification because you subscribed to receive alerts when the following products are back in stock:') ?>
+
+
+
+
+
+
+ getShortDescription()): ?>
+
+
+ getPrice() != $_product->getFinalPrice()): ?>
+ __('Regular Price:') ?> formatPrice($_product->getPrice()) ?>
+ __('Special price:') ?> formatPrice($_product->getFinalPrice()) ?>
+
+ __('Price:') ?> formatPrice($_product->getPrice()) ?>
+
+ __('Click here not to receive alerts for this product') ?>
+
+
+
+
+__('Unsubscribe from all stock alerts') ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/eway/form.phtml b/app/design/frontend/default/blank/template/eway/form.phtml
new file mode 100644
index 0000000000..3dfb44e201
--- /dev/null
+++ b/app/design/frontend/default/blank/template/eway/form.phtml
@@ -0,0 +1,91 @@
+
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/eway/info.phtml b/app/design/frontend/default/blank/template/eway/info.phtml
new file mode 100644
index 0000000000..a4e13d29f4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/eway/info.phtml
@@ -0,0 +1,34 @@
+
+getInfo()): ?>
+ __('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+ __('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+ __('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+ __('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/eway/secure/failure.phtml b/app/design/frontend/default/blank/template/eway/secure/failure.phtml
new file mode 100644
index 0000000000..e4b6c99691
--- /dev/null
+++ b/app/design/frontend/default/blank/template/eway/secure/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>.
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/eway/secure/form.phtml b/app/design/frontend/default/blank/template/eway/secure/form.phtml
new file mode 100644
index 0000000000..067ab9a98d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/eway/secure/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/eway/shared/failure.phtml b/app/design/frontend/default/blank/template/eway/shared/failure.phtml
new file mode 100644
index 0000000000..bead8836ea
--- /dev/null
+++ b/app/design/frontend/default/blank/template/eway/shared/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>.
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
diff --git a/app/design/frontend/default/blank/template/eway/shared/form.phtml b/app/design/frontend/default/blank/template/eway/shared/form.phtml
new file mode 100644
index 0000000000..de771acaf7
--- /dev/null
+++ b/app/design/frontend/default/blank/template/eway/shared/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/flo2cash/form.phtml b/app/design/frontend/default/blank/template/flo2cash/form.phtml
new file mode 100644
index 0000000000..2f25bfa6e6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/flo2cash/form.phtml
@@ -0,0 +1,90 @@
+
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/flo2cash/info.phtml b/app/design/frontend/default/blank/template/flo2cash/info.phtml
new file mode 100644
index 0000000000..72f9a2b3de
--- /dev/null
+++ b/app/design/frontend/default/blank/template/flo2cash/info.phtml
@@ -0,0 +1,35 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+ __('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+ __('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+ __('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+ __('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/giftmessage/form.phtml b/app/design/frontend/default/blank/template/giftmessage/form.phtml
new file mode 100644
index 0000000000..251501d902
--- /dev/null
+++ b/app/design/frontend/default/blank/template/giftmessage/form.phtml
@@ -0,0 +1,81 @@
+
+
+getSaveMode()): ?>
+
+
__('Gift Message') ?>
+
+
+getSaveMode()=='save'): ?>
+__('Your gift message has been successfully saved') ?>
+__('Close') ?>
+
+__('Your gift message has been successfully removed') ?>
+__('Close') ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/giftmessage/helper.phtml b/app/design/frontend/default/blank/template/giftmessage/helper.phtml
new file mode 100644
index 0000000000..28939342a3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/giftmessage/helper.phtml
@@ -0,0 +1,80 @@
+
+getScriptIncluded() && $this->getCanDisplayContainer()): ?>
+
+setScriptIncluded(true); ?>
+
+getCanDisplayContainer()): ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/giftmessage/inline.phtml b/app/design/frontend/default/blank/template/giftmessage/inline.phtml
new file mode 100644
index 0000000000..fc658aa6be
--- /dev/null
+++ b/app/design/frontend/default/blank/template/giftmessage/inline.phtml
@@ -0,0 +1,275 @@
+
+getDontDisplayContainer()): ?>
+
+
+getType()): ?>
+
+
+
__('Do you have any gift items in your order?'); ?>
+
+ getItemsHasMesssages() || $this->getEntityHasMessage()): ?> checked="checked" class="checkbox" />
+ __('Check this checkbox if you want to add gift messages.') ?>
+
+
+
+
+
+
+
+
+
+
+
__('Gift Messages'); ?>
+
+ getItemsHasMesssages() || $this->getEntityHasMessage()): ?> checked="checked" class="checkbox" />
+ __('Check this checkbox if you want to add gift messages to your items.') ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/googlecheckout/form.phtml b/app/design/frontend/default/blank/template/googlecheckout/form.phtml
new file mode 100644
index 0000000000..443ce854f4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/googlecheckout/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/googlecheckout/link.phtml b/app/design/frontend/default/blank/template/googlecheckout/link.phtml
new file mode 100644
index 0000000000..d1a45ce4bd
--- /dev/null
+++ b/app/design/frontend/default/blank/template/googlecheckout/link.phtml
@@ -0,0 +1,38 @@
+
+
+ getIsDisabled()): ?>
+
+
+ getIsActiveAanalytics()):?> onsubmit="setUrchinInputCode(pageTracker)">
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/ideal/advanced/failure.phtml b/app/design/frontend/default/blank/template/ideal/advanced/failure.phtml
new file mode 100644
index 0000000000..629f4770b8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/ideal/advanced/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/ideal/advanced/form.phtml b/app/design/frontend/default/blank/template/ideal/advanced/form.phtml
new file mode 100755
index 0000000000..411a5cb46c
--- /dev/null
+++ b/app/design/frontend/default/blank/template/ideal/advanced/form.phtml
@@ -0,0 +1,42 @@
+
+getMethodCode() ?>
+getIssuerList()):?>
+
+
diff --git a/app/design/frontend/default/blank/template/ideal/advanced/info.phtml b/app/design/frontend/default/blank/template/ideal/advanced/info.phtml
new file mode 100644
index 0000000000..e5879f72a2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/ideal/advanced/info.phtml
@@ -0,0 +1,33 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+
+ __('Issuer'). ': ' . $this->getIssuerTitle() ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/ideal/basic/failure.phtml b/app/design/frontend/default/blank/template/ideal/basic/failure.phtml
new file mode 100644
index 0000000000..c2ef40cac7
--- /dev/null
+++ b/app/design/frontend/default/blank/template/ideal/basic/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
diff --git a/app/design/frontend/default/blank/template/ideal/basic/form.phtml b/app/design/frontend/default/blank/template/ideal/basic/form.phtml
new file mode 100755
index 0000000000..a0a7e4f482
--- /dev/null
+++ b/app/design/frontend/default/blank/template/ideal/basic/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/newsletter/subscribe.phtml b/app/design/frontend/default/blank/template/newsletter/subscribe.phtml
new file mode 100644
index 0000000000..8742f1356a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/newsletter/subscribe.phtml
@@ -0,0 +1,54 @@
+
+
+
+
+
+ __('Newsletter') ?>
+ getErrorMessage() ): ?>
+
+
+ getSuccessMessage() ): ?>
+
+
+ */ ?>
+ __('Sign up for our newsletter:') ?>
+
+
+
+ __('Subscribe') ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/oscommerce/order/list.phtml b/app/design/frontend/default/blank/template/oscommerce/order/list.phtml
new file mode 100644
index 0000000000..29b5164a7a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/oscommerce/order/list.phtml
@@ -0,0 +1,56 @@
+
+getOsCommerceOrders(); ?>
+
+
+
__('My Previous Orders') ?>
+
+
+
+
+ __('Order #') ?>
+ __('Date') ?>
+ __('Ship to') ?>
+ __('Order Total') ?>
+
+
+
+
+
+
+
+
+ formatDate($_oscOrder['date_purchased'], 'medium', true) ?>
+ htmlEscape($_oscOrder['delivery_street_address']) ?>
+
+ __('View Order') ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/oscommerce/order/view.phtml b/app/design/frontend/default/blank/template/oscommerce/order/view.phtml
new file mode 100644
index 0000000000..718b81e394
--- /dev/null
+++ b/app/design/frontend/default/blank/template/oscommerce/order/view.phtml
@@ -0,0 +1,141 @@
+
+getOrder() ?>
+
+
+
+
+
__('Order') ?> #
+
+__('Order Date:')?> formatDate($_order['date_purchased'], 'medium', false) ?>
+
+
+
+
__('Shipping Address') ?>
+
+
+
+
+
+
+T:
+
+
+
+
+
+
+
__('Shipping Method') ?>
+
+
+
+
+
+
+
+
+
__('Billing Address') ?>
+
+
+
+
+
+
+T:
+
+
+
+
+
Payment Method
+
+
+
+
+__('Items Ordered') ?>
+
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty Ordered') ?>
+ __('Subtotal') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __('About Your Order') ?>
+
+
+ formatDate($_historyItem['date_added'], 'medium', true) ?> |
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/page/1column.phtml b/app/design/frontend/default/blank/template/page/1column.phtml
new file mode 100644
index 0000000000..64fe08c263
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/1column.phtml
@@ -0,0 +1,55 @@
+
+
+
+
+
+getChildHtml('head') ?>
+
+getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
+
+ getChildHtml('global_notices') ?>
+
+ getChildHtml('header') ?>
+
+ getChildHtml('breadcrumbs') ?>
+
+ getChildHtml('global_messages') ?>
+ getChildHtml('content') ?>
+
+
+ getChildHtml('footer') ?>
+ getChildHtml('before_body_end') ?>
+
+
+getAbsoluteFooter() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/page/2columns-left.phtml b/app/design/frontend/default/blank/template/page/2columns-left.phtml
new file mode 100644
index 0000000000..f2dc635d44
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/2columns-left.phtml
@@ -0,0 +1,56 @@
+
+
+
+
+
+getChildHtml('head') ?>
+
+getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
+
+ getChildHtml('global_notices') ?>
+
+ getChildHtml('header') ?>
+
+ getChildHtml('breadcrumbs') ?>
+
+
+ getChildHtml('global_messages') ?>
+ getChildHtml('content') ?>
+
+
+ getChildHtml('footer') ?>
+ getChildHtml('before_body_end') ?>
+
+
+getAbsoluteFooter() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/page/2columns-right.phtml b/app/design/frontend/default/blank/template/page/2columns-right.phtml
new file mode 100644
index 0000000000..b5c704214f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/2columns-right.phtml
@@ -0,0 +1,56 @@
+
+
+
+
+
+getChildHtml('head') ?>
+
+getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
+
+ getChildHtml('global_notices') ?>
+
+ getChildHtml('header') ?>
+
+ getChildHtml('breadcrumbs') ?>
+
+
+ getChildHtml('global_messages') ?>
+ getChildHtml('content') ?>
+
+
+ getChildHtml('footer') ?>
+ getChildHtml('before_body_end') ?>
+
+
+getAbsoluteFooter() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/page/3columns.phtml b/app/design/frontend/default/blank/template/page/3columns.phtml
new file mode 100644
index 0000000000..1bbe1a0ffb
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/3columns.phtml
@@ -0,0 +1,57 @@
+
+
+
+
+
+getChildHtml('head') ?>
+
+getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
+
+ getChildHtml('global_notices') ?>
+
+ getChildHtml('header') ?>
+
+ getChildHtml('breadcrumbs') ?>
+
+
+
+ getChildHtml('global_messages') ?>
+ getChildHtml('content') ?>
+
+
+ getChildHtml('footer') ?>
+ getChildHtml('before_body_end') ?>
+
+
+getAbsoluteFooter() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/page/html/breadcrumbs.phtml b/app/design/frontend/default/blank/template/page/html/breadcrumbs.phtml
new file mode 100644
index 0000000000..0fcdf17f2b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/html/breadcrumbs.phtml
@@ -0,0 +1,47 @@
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/page/html/footer.phtml b/app/design/frontend/default/blank/template/page/html/footer.phtml
new file mode 100644
index 0000000000..9a43b377ea
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/html/footer.phtml
@@ -0,0 +1,31 @@
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/page/html/head.phtml b/app/design/frontend/default/blank/template/page/html/head.phtml
new file mode 100644
index 0000000000..2b3096450e
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/html/head.phtml
@@ -0,0 +1,43 @@
+
+getTitle() ?>
+
+
+
+
+
+
+
+getCssJsHtml() ?>
+getChildHtml() ?>
+helper('core/js')->getTranslatorScript() ?>
+getIncludes() ?>
diff --git a/app/design/frontend/default/blank/template/page/html/header.phtml b/app/design/frontend/default/blank/template/page/html/header.phtml
new file mode 100644
index 0000000000..13f12014be
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/html/header.phtml
@@ -0,0 +1,36 @@
+
+
diff --git a/app/design/frontend/default/blank/template/page/html/notices.phtml b/app/design/frontend/default/blank/template/page/html/notices.phtml
new file mode 100644
index 0000000000..1f5c008294
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/html/notices.phtml
@@ -0,0 +1,44 @@
+
+
+displayNoscriptNotice()): ?>
+
+
+
+
__('We detected that your JavaScript seem to be disabled.'); ?>
+
__('You must have JavaScript enabled in your browser to utilize the functionality of this website.'); ?>
+
+
+
+
+displayDemoNotice()): ?>
+ __('This is a demo store. Any orders placed through this store will not be honored or fulfilled.') ?>
+
diff --git a/app/design/frontend/default/blank/template/page/html/pager.phtml b/app/design/frontend/default/blank/template/page/html/pager.phtml
new file mode 100644
index 0000000000..d0a5da2b56
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/html/pager.phtml
@@ -0,0 +1,78 @@
+
+
+getCollection()->getSize()): ?>
+
+
diff --git a/app/design/frontend/default/blank/template/page/html/top.links.phtml b/app/design/frontend/default/blank/template/page/html/top.links.phtml
new file mode 100644
index 0000000000..77ddf182e8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/html/top.links.phtml
@@ -0,0 +1,34 @@
+
+
+
+ getChildHtml() ?>
+
+ class="first last" >>
+
+
+
diff --git a/app/design/frontend/default/blank/template/page/html/wrapper.phtml b/app/design/frontend/default/blank/template/page/html/wrapper.phtml
new file mode 100644
index 0000000000..296ff6c5c0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/html/wrapper.phtml
@@ -0,0 +1,46 @@
+
+
+ * some-custom-identificator
+ *
+ *
+ * span
+ * class="custom-class"
+ *
+ *
+ *
+ */
+?>
+hasTag() ? $this->getTag() : "div" ?>
+< id="getId()?>" getParams()?>>
+getChildHtml()?>
+>
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/page/js/calendar.phtml b/app/design/frontend/default/blank/template/page/js/calendar.phtml
new file mode 100644
index 0000000000..ebc0fe3517
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/js/calendar.phtml
@@ -0,0 +1,94 @@
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/page/one-column.phtml b/app/design/frontend/default/blank/template/page/one-column.phtml
new file mode 100644
index 0000000000..bb35e619cf
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/one-column.phtml
@@ -0,0 +1,42 @@
+
+
+
+
+
+ getChildHtml('head') ?>
+
+
+ getChildHtml('content') ?>
+ getChildHtml('before_body_end') ?>
+ getAbsoluteFooter() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/page/popup.phtml b/app/design/frontend/default/blank/template/page/popup.phtml
new file mode 100644
index 0000000000..497e16935c
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/popup.phtml
@@ -0,0 +1,44 @@
+
+
+
+
+
+getChildHtml('head') ?>
+
+
+
+ getChildHtml('content') ?>
+ getChildHtml('before_body_end') ?>
+
+getAbsoluteFooter() ?>
+
+
diff --git a/app/design/frontend/default/blank/template/page/print.phtml b/app/design/frontend/default/blank/template/page/print.phtml
new file mode 100644
index 0000000000..72bcbb64c4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/print.phtml
@@ -0,0 +1,52 @@
+
+
+
+
+
+getChildHtml('head') ?>
+
+
+
+
+
+ getPrintLogoText()):?>
+
htmlEscape($this->getPrintLogoText())) ?>
+
+
+ getChildHtml('content') ?>
+
+ __('Close Window') ?>
+
+ getAbsoluteFooter() ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/page/redirect.phtml b/app/design/frontend/default/blank/template/page/redirect.phtml
new file mode 100644
index 0000000000..fc512ac294
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/redirect.phtml
@@ -0,0 +1,36 @@
+
+
+
__('Redirecting...') ?>
+
+getMessage()): ?>
+ getMessage() ?>
+
+getRedirectOutput() ?>
+isHtmlFormRedirect()): ?>
+ __('Click here if nothing has happened', $this->getTargetURL()) ?>
+
diff --git a/app/design/frontend/default/blank/template/page/switch/flags.phtml b/app/design/frontend/default/blank/template/page/switch/flags.phtml
new file mode 100644
index 0000000000..eafa333ebc
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/switch/flags.phtml
@@ -0,0 +1,38 @@
+
+getStores())>1): ?>
+
+ __('Your Language') ?>:
+
+ getStores() as $_lang): ?>
+ getId() == $this->getCurrentStoreId()) ? 'selected="selected"' : '' ?>
+ >
+ htmlEscape($_lang->getName()) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/page/switch/languages.phtml b/app/design/frontend/default/blank/template/page/switch/languages.phtml
new file mode 100644
index 0000000000..c4ae75af30
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/switch/languages.phtml
@@ -0,0 +1,44 @@
+
+
+getStores())>1): ?>
+
+ __('Your Language') ?>:
+
+ getStores() as $_lang): ?>
+ getId()==$this->getCurrentStoreId()) ? ' selected="selected"' : '' ?>
+ >htmlEscape($_lang->getName()) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/page/switch/stores.phtml b/app/design/frontend/default/blank/template/page/switch/stores.phtml
new file mode 100644
index 0000000000..fab3aff534
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/switch/stores.phtml
@@ -0,0 +1,47 @@
+
+
+getGroups())>1): ?>
+
+ __('Select Store') ?>:
+
+ getStores() as $_store): ?>
+ getId()==$this->getCurrentStoreId()): ?> selected="selected">getName() ?>
+
+ getGroups() as $_group): ?>
+ getId()==$this->getCurrentGroupId()) ? ' selected="selected"' : '' ?>
+ >htmlEscape($_group->getName()) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/page/template/container.phtml b/app/design/frontend/default/blank/template/page/template/container.phtml
new file mode 100644
index 0000000000..ef15d6ea45
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/template/container.phtml
@@ -0,0 +1,35 @@
+
+
+
+
getTitle() ?>
+
+getChildHtml() ?>
diff --git a/app/design/frontend/default/blank/template/page/template/links.phtml b/app/design/frontend/default/blank/template/page/template/links.phtml
new file mode 100644
index 0000000000..a5ba5abb4c
--- /dev/null
+++ b/app/design/frontend/default/blank/template/page/template/links.phtml
@@ -0,0 +1,39 @@
+
+
+getLinks(); ?>
+0): ?>
+getName()): ?> id="getName() ?>">
+
+ getIsFirst()||$_link->getIsLast()): ?> class="getIsFirst()): ?>firstgetIsLast()): ?> last" getLiParams() ?>>getBeforeText() ?>getAParams() ?>>getLabel() ?> getAfterText() ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/paybox/direct/form.phtml b/app/design/frontend/default/blank/template/paybox/direct/form.phtml
new file mode 100644
index 0000000000..4fc542b50a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paybox/direct/form.phtml
@@ -0,0 +1,92 @@
+
+
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/paybox/direct/info.phtml b/app/design/frontend/default/blank/template/paybox/direct/info.phtml
new file mode 100644
index 0000000000..19624389db
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paybox/direct/info.phtml
@@ -0,0 +1,35 @@
+
+getInfo()): ?>
+ getMethod()->getTitle() ?>
+ __('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+ __('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+ __('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+ __('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/paybox/system/error.phtml b/app/design/frontend/default/blank/template/paybox/system/error.phtml
new file mode 100644
index 0000000000..7d2ce10208
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paybox/system/error.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>.
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
diff --git a/app/design/frontend/default/blank/template/paybox/system/form.phtml b/app/design/frontend/default/blank/template/paybox/system/form.phtml
new file mode 100644
index 0000000000..8e63a1b2e0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paybox/system/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/payment/form/cc.phtml b/app/design/frontend/default/blank/template/payment/form/cc.phtml
new file mode 100644
index 0000000000..f793f3ae6b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/form/cc.phtml
@@ -0,0 +1,84 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/payment/form/ccsave.phtml b/app/design/frontend/default/blank/template/payment/form/ccsave.phtml
new file mode 100644
index 0000000000..8698cf1182
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/form/ccsave.phtml
@@ -0,0 +1,83 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/payment/form/checkmo.phtml b/app/design/frontend/default/blank/template/payment/form/checkmo.phtml
new file mode 100644
index 0000000000..391d97d5cb
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/form/checkmo.phtml
@@ -0,0 +1,43 @@
+
+getMethod()->getMailingAddress() || $this->getMethod()->getPayableTo()): ?>
+
+
diff --git a/app/design/frontend/default/blank/template/payment/form/purchaseorder.phtml b/app/design/frontend/default/blank/template/payment/form/purchaseorder.phtml
new file mode 100644
index 0000000000..9ac029b5c2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/form/purchaseorder.phtml
@@ -0,0 +1,34 @@
+
+
diff --git a/app/design/frontend/default/blank/template/payment/info/cc.phtml b/app/design/frontend/default/blank/template/payment/info/cc.phtml
new file mode 100644
index 0000000000..8c619f73e1
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/info/cc.phtml
@@ -0,0 +1,34 @@
+
+getInfo()): ?>
+
+ __('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+ __('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+ __('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
+
+
+
diff --git a/app/design/frontend/default/blank/template/payment/info/ccsave.phtml b/app/design/frontend/default/blank/template/payment/info/ccsave.phtml
new file mode 100644
index 0000000000..3ef7be67c9
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/info/ccsave.phtml
@@ -0,0 +1,30 @@
+
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
diff --git a/app/design/frontend/default/blank/template/payment/info/checkmo.phtml b/app/design/frontend/default/blank/template/payment/info/checkmo.phtml
new file mode 100644
index 0000000000..588fce1535
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/info/checkmo.phtml
@@ -0,0 +1,38 @@
+
+getMethod()->getTitle() ?>
+getInfo()->getAdditionalData()): ?>
+ getPayableTo()): ?> __('Make Check payable to: %s', $this->htmlEscape($this->getPayableTo())) ?>
+ getMailingAddress()): ?>
+ __('Send Check to:') ?>
+
+
+ htmlEscape($this->getMailingAddress())) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/payment/info/default.phtml b/app/design/frontend/default/blank/template/payment/info/default.phtml
new file mode 100644
index 0000000000..db8b2204c3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/info/default.phtml
@@ -0,0 +1,27 @@
+
+htmlEscape($this->getMethod()->getTitle()) ?>
diff --git a/app/design/frontend/default/blank/template/payment/info/purchaseorder.phtml b/app/design/frontend/default/blank/template/payment/info/purchaseorder.phtml
new file mode 100644
index 0000000000..23449c2e4d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/payment/info/purchaseorder.phtml
@@ -0,0 +1,28 @@
+
+getMethod()->getTitle() ?>
+__('Purchase Order Number') ?>: htmlEscape($this->getInfo()->getPoNumber()) ?>
diff --git a/app/design/frontend/default/blank/template/paypal/express/form.phtml b/app/design/frontend/default/blank/template/paypal/express/form.phtml
new file mode 100644
index 0000000000..39430db6c3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypal/express/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/paypal/express/info.phtml b/app/design/frontend/default/blank/template/paypal/express/info.phtml
new file mode 100644
index 0000000000..1efdc9ca26
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypal/express/info.phtml
@@ -0,0 +1,28 @@
+
+getMethod()->getTitle() ?>
+__('PayPal Email') ?>: getEmail() ?>
diff --git a/app/design/frontend/default/blank/template/paypal/express/review.phtml b/app/design/frontend/default/blank/template/paypal/express/review.phtml
new file mode 100644
index 0000000000..306e60faac
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypal/express/review.phtml
@@ -0,0 +1,149 @@
+
+
+
__('Review Order') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+__('Shipping Information') ?>
+
+
+
+
+ getShippingAddress()->getFormated(true) ?>
+
+
+
+
__('Shipping Method') ?>
+ isVirtual()): ?>
+
__('No shipping method required.') ?>
+
+ getShippingRates())): ?>
+
__('Sorry, no quotes are available for this order at this time.') ?>
+
+
+
+
+ getAddressShippingMethod()): ?>
+ __('Please select a shipping method...') ?>
+
+ $_rates): ?>
+
+
+ getErrorMessage()): ?>
+
+ getErrorMessage() ?>
+
+
+ getCode()===$this->getAddressShippingMethod()): ?> selected="selected" style="margin-left:16px;">
+ getMethodTitle() ?> -
+
+ getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
+ getShippingPrice($_rate->getPrice(), true); ?>
+
+
+ helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
+ (__('Incl. Tax'); ?> )
+
+
+
+
+
+
+
+
+ __('Update Shipping Method') ?>
+
+
+
+
+
+
+
+
+
+
+
+__('Billing Information') ?>
+
+__('PayPal Account') ?>
+getBillingAddress()->getEmail() ?>
+
+
+
+
+ getChildHtml('details') ?>
+
+
+
+
+
+
+
+
+ __('Place an Order') ?>
+
+
+ __('Submitting order information...') ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/paypal/express/review/details.phtml b/app/design/frontend/default/blank/template/paypal/express/review/details.phtml
new file mode 100644
index 0000000000..9911a17d91
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypal/express/review/details.phtml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('Price') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+
+
+
+ getTotals() as $_total): ?>
+
+ getTitle() ?>
+ helper('checkout')->formatPrice($_total->getValue()) ?>
+
+
+
+
+ getItems() as $_item): ?>
+ getParentItem()) continue ?>
+
+
+ getProduct()->getName() ?>
+ getProduct()->getDescription() ?>
+
+ helper('checkout')->formatPrice($_item->getCalculationPrice()); ?>
+ getQty() ?>
+ helper('checkout')->formatPrice($_item->getRowTotal()); ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/paypal/link.phtml b/app/design/frontend/default/blank/template/paypal/link.phtml
new file mode 100644
index 0000000000..f3f1e89f95
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypal/link.phtml
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/paypal/standard/form.phtml b/app/design/frontend/default/blank/template/paypal/standard/form.phtml
new file mode 100644
index 0000000000..8643097ed0
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypal/standard/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/paypaluk/direct/form.phtml b/app/design/frontend/default/blank/template/paypaluk/direct/form.phtml
new file mode 100644
index 0000000000..a39ebc47c6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypaluk/direct/form.phtml
@@ -0,0 +1,117 @@
+
+
+getMethodCode() ?>
+hasSsCardType()): ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/paypaluk/direct/info.phtml b/app/design/frontend/default/blank/template/paypaluk/direct/info.phtml
new file mode 100644
index 0000000000..cb06ad7d09
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypaluk/direct/info.phtml
@@ -0,0 +1,38 @@
+
+getInfo()): ?>
+
+ __('Credit Card Type: %s', $this->getCcTypeName()) ?>
+ __('Credit Card Number: xxxx-%s', $this->getInfo()->getCcLast4()) ?>
+ __('Expiration Date: %s/%s', $this->getCcExpMonth(), $this->getInfo()->getCcExpYear()) ?>
+ getInfo()->getCcSsIssue()): ?>
+ __("Switch/Solo card issue number: %s", $this->getInfo()->getCcSsIssue()) ?>
+
+ getInfo()->getCcSsStartYear()): ?>
+ __('Switch/Solo card start Date: %s/%s', $this->getCcStartMonth(), $this->getInfo()->getCcSsStartYear()) ?>
+
+
diff --git a/app/design/frontend/default/blank/template/paypaluk/express/form.phtml b/app/design/frontend/default/blank/template/paypaluk/express/form.phtml
new file mode 100644
index 0000000000..1dfe9ee478
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypaluk/express/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/paypaluk/express/info.phtml b/app/design/frontend/default/blank/template/paypaluk/express/info.phtml
new file mode 100644
index 0000000000..1efdc9ca26
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypaluk/express/info.phtml
@@ -0,0 +1,28 @@
+
+getMethod()->getTitle() ?>
+__('PayPal Email') ?>: getEmail() ?>
diff --git a/app/design/frontend/default/blank/template/paypaluk/express/review.phtml b/app/design/frontend/default/blank/template/paypaluk/express/review.phtml
new file mode 100644
index 0000000000..dcb84b4a52
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypaluk/express/review.phtml
@@ -0,0 +1,147 @@
+
+
+
__('Review Order') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
__('Shipping Information') ?>
+
+
+
+
+ getShippingAddress()->getFormated(true) ?>
+
+
+
+
__('Shipping Method') ?>
+ isVirtual()): ?>
+
__('No shipping method required.') ?>
+
+ getShippingRates())): ?>
+
__('Sorry, no quotes are available for this order at this time.') ?>
+
+
+
+
+ getAddressShippingMethod()): ?>
+ __('Please select a shipping method...') ?>
+
+ $_rates): ?>
+
+
+ getErrorMessage()): ?>
+
+ getErrorMessage() ?>
+
+
+ getCode()===$this->getAddressShippingMethod()): ?> selected="selected" style="margin-left:16px;">
+ getMethodTitle() ?> -
+
+ getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
+ getShippingPrice($_rate->getPrice(), true); ?>
+
+
+ helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
+ (__('Incl. Tax'); ?> )
+
+
+
+
+
+
+
+
+ __('Update Shipping Method') ?>
+
+
+
+
+
+
+
+
+
+
+
__('Billing Information') ?>
+
+
__('PayPal Uk Account') ?>
+ getBillingAddress()->getEmail() ?>
+
+
+
+
+
+
+ getChildHtml('details') ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/paypaluk/express/review/details.phtml b/app/design/frontend/default/blank/template/paypaluk/express/review/details.phtml
new file mode 100644
index 0000000000..8e97bafb42
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypaluk/express/review/details.phtml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('Price') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+
+
+
+ getItems() as $_item): ?>
+ getParentItem()) continue ?>
+
+
+ getProduct()->getName() ?>
+ getProduct()->getDescription() ?>
+
+ helper('checkout')->formatPrice($_item->getCalculationPrice()); ?>
+ getQty() ?>
+ helper('checkout')->formatPrice($_item->getRowTotal()); ?>
+
+
+
+
+ getTotals() as $_total): ?>
+
+ getTitle() ?>
+ helper('checkout')->formatPrice($_total->getValue()) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/paypaluk/link.phtml b/app/design/frontend/default/blank/template/paypaluk/link.phtml
new file mode 100644
index 0000000000..9941c66148
--- /dev/null
+++ b/app/design/frontend/default/blank/template/paypaluk/link.phtml
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/poll/active.phtml b/app/design/frontend/default/blank/template/poll/active.phtml
new file mode 100644
index 0000000000..0205083fd3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/poll/active.phtml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
__('Community Poll') ?>
+
+
+
+ __('Community Poll') ?>
+ getPollTitle(); ?>
+
+
+
+
+
+ getAnswerTitle() ?>
+
+
+
+
+
+ __('Vote') ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/poll/result.phtml b/app/design/frontend/default/blank/template/poll/result.phtml
new file mode 100644
index 0000000000..339d8f0cf6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/poll/result.phtml
@@ -0,0 +1,46 @@
+
+
+
+
+
__('Community Poll') ?>
+
+
+
getPollTitle(); ?>
+
+
+
+
+ getAnswerTitle() ?>:
+ getVotesCount() ?> (getPercent() ?>%)
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/productalert/price.phtml b/app/design/frontend/default/blank/template/productalert/price.phtml
new file mode 100644
index 0000000000..818ca60e10
--- /dev/null
+++ b/app/design/frontend/default/blank/template/productalert/price.phtml
@@ -0,0 +1,29 @@
+
+isShow()): ?>
+ __('Sign up for price alert'); ?>
+
diff --git a/app/design/frontend/default/blank/template/productalert/stock.phtml b/app/design/frontend/default/blank/template/productalert/stock.phtml
new file mode 100644
index 0000000000..e37169aa82
--- /dev/null
+++ b/app/design/frontend/default/blank/template/productalert/stock.phtml
@@ -0,0 +1,29 @@
+
+isShow()): ?>
+ __('Sign up to get notified when this product is back in stock'); ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/protx/standard/failure.phtml b/app/design/frontend/default/blank/template/protx/standard/failure.phtml
new file mode 100644
index 0000000000..e12f6d1213
--- /dev/null
+++ b/app/design/frontend/default/blank/template/protx/standard/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>.
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
diff --git a/app/design/frontend/default/blank/template/protx/standard/form.phtml b/app/design/frontend/default/blank/template/protx/standard/form.phtml
new file mode 100644
index 0000000000..2f7d76963f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/protx/standard/form.phtml
@@ -0,0 +1,30 @@
+
+getMethodCode() ?>
+
diff --git a/app/design/frontend/default/blank/template/rating/detailed.phtml b/app/design/frontend/default/blank/template/rating/detailed.phtml
new file mode 100644
index 0000000000..13b26c2ed8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/rating/detailed.phtml
@@ -0,0 +1,46 @@
+
+getSize()): ?>
+
+
+
+
+
+ getSummary()): ?>
+
+ __($_rating->getRatingCode()) ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/rating/empty.phtml b/app/design/frontend/default/blank/template/rating/empty.phtml
new file mode 100644
index 0000000000..c51627aee4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/rating/empty.phtml
@@ -0,0 +1,29 @@
+
+
diff --git a/app/design/frontend/default/blank/template/reports/home_product_compared.phtml b/app/design/frontend/default/blank/template/reports/home_product_compared.phtml
new file mode 100644
index 0000000000..a7b50c2426
--- /dev/null
+++ b/app/design/frontend/default/blank/template/reports/home_product_compared.phtml
@@ -0,0 +1,61 @@
+
+getRecentlyComparedProducts()): ?>
+
+
__('Your Recently Compared') ?>
+
+
+
+
+ 5): continue; endif; ?>
+
+
+
+ getReviewsSummaryHtml($_product, 'short') ?>
+ getPriceHtml($_product, true, '-home-compared') ?>
+ isSaleable()): ?>
+ __('Add to Cart') ?>
+
+ __('Out of stock') ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/reports/home_product_viewed.phtml b/app/design/frontend/default/blank/template/reports/home_product_viewed.phtml
new file mode 100644
index 0000000000..99bb9df126
--- /dev/null
+++ b/app/design/frontend/default/blank/template/reports/home_product_viewed.phtml
@@ -0,0 +1,66 @@
+
+
+getRecentlyViewedProducts()): ?>
+
+
__('Your Recently Viewed') ?>
+
+
+
+
+ 5): continue; endif; ?>
+
+
+
+ getReviewsSummaryHtml($_product, 'short') ?>
+ getPriceHtml($_product, true, '-home-viewed') ?>
+ isSaleable()): ?>
+ __('Add to Cart') ?>
+
+ __('Out of stock') ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/reports/product_compared.phtml b/app/design/frontend/default/blank/template/reports/product_compared.phtml
new file mode 100644
index 0000000000..48f96d5e5d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/reports/product_compared.phtml
@@ -0,0 +1,42 @@
+
+getRecentlyComparedProducts()): ?>
+
+
+
__('Recently Compared Products') ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/reports/product_viewed.phtml b/app/design/frontend/default/blank/template/reports/product_viewed.phtml
new file mode 100644
index 0000000000..8d52bf32be
--- /dev/null
+++ b/app/design/frontend/default/blank/template/reports/product_viewed.phtml
@@ -0,0 +1,42 @@
+
+getRecentlyViewedProducts()): ?>
+
+
+
__('Recently Viewed Products') ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/review/customer/list.phtml b/app/design/frontend/default/blank/template/review/customer/list.phtml
new file mode 100644
index 0000000000..360c322d58
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/customer/list.phtml
@@ -0,0 +1,64 @@
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
__('My Product Reviews') ?>
+
+getCollection() && $this->count()): ?>
+ getToolbarHtml() ?>
+
+
+
+
+
+
+
+ getCollection() as $_review): ?>
+
+ dateFormat($_review->getCreatedAt()) ?>
+
+
+ getSum()): ?>
+
+
+
+ htmlEscape($this->helper('review')->getDetail($_review->getDetail())) ?>
+ __('View Details') ?>
+
+
+
+
+
+ getToolbarHtml() ?>
+
+ __('You have submitted no reviews.') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/review/customer/recent.phtml b/app/design/frontend/default/blank/template/review/customer/recent.phtml
new file mode 100644
index 0000000000..2e66155e29
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/customer/recent.phtml
@@ -0,0 +1,50 @@
+
+getCollection() && $this->count()): ?>
+
+
+
+
+ getCollection() as $_review): ?>
+
+
+
+ getSum()): ?>
+ __('Rating:') ?>
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/review/customer/view.phtml b/app/design/frontend/default/blank/template/review/customer/view.phtml
new file mode 100644
index 0000000000..a438100ae9
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/customer/view.phtml
@@ -0,0 +1,65 @@
+
+getProductData()->getId()): ?>
+
+
+
__('Review Details') ?>
+
+
+
+ getRating() && $this->getRating()->getSize()): ?>
+
__('Average Customer Rating:') ?>
+ getReviewsSummaryHtml($this->getProductData()) ?>
+
+
+
+
htmlEscape($this->getProductData()->getName()) ?>
+ getRating() && $this->getRating()->getSize()): ?>
+
__('Your Rating:') ?>
+
+ getRating() as $_rating): ?>
+ getPercent()): ?>
+
+ getRatingCode() ?>
+
+
+
+
+
+
+
+ __('Your Review (submitted on %s):', $this->dateFormat($this->getReviewData()->getCreatedAt())) ?>
+
htmlEscape($this->getReviewData()->getDetail())) ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/review/form.phtml b/app/design/frontend/default/blank/template/review/form.phtml
new file mode 100644
index 0000000000..5f3af85f20
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/form.phtml
@@ -0,0 +1,117 @@
+
+
+
+ __('Write Your Own Review') ?>
+ __("You're reviewing:"); ?> htmlEscape($this->getProductInfo()->getName()) ?>
+ getRatings() && $this->getRatings()->getSize()): ?>
+ __('How do you rate this product?') ?> *
+
+
+
+
+
+
+
+ __('Submit Review') ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/review/helper/summary.phtml b/app/design/frontend/default/blank/template/review/helper/summary.phtml
new file mode 100644
index 0000000000..0d0e562990
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/helper/summary.phtml
@@ -0,0 +1,42 @@
+
+getReviewsCount()): ?>
+
+getDisplayIfEmpty()): ?>
+ __('Be the first to review this product') ?>
+
diff --git a/app/design/frontend/default/blank/template/review/helper/summary_short.phtml b/app/design/frontend/default/blank/template/review/helper/summary_short.phtml
new file mode 100644
index 0000000000..a51d50e541
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/helper/summary_short.phtml
@@ -0,0 +1,40 @@
+
+getReviewsCount()): ?>
+
+getDisplayIfEmpty()): ?>
+ __('Be the first to review this product') ?>
+
diff --git a/app/design/frontend/default/blank/template/review/product/view/count.phtml b/app/design/frontend/default/blank/template/review/product/view/count.phtml
new file mode 100644
index 0000000000..c3fe700f7d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/product/view/count.phtml
@@ -0,0 +1,29 @@
+
+
+ __('%s Review(s)', $count) ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/review/product/view/list.phtml b/app/design/frontend/default/blank/template/review/product/view/list.phtml
new file mode 100644
index 0000000000..4c99704801
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/product/view/list.phtml
@@ -0,0 +1,63 @@
+
+
+getReviewsCollection()->getItems();?>
+
+
+
__('Customer Reviews') ?>
+ getChildHtml('toolbar') ?>
+
+
+
+ htmlEscape($_review->getTitle()) ?> __('Review by %s', $this->htmlEscape($_review->getNickname())) ?>
+
+
+
+
+
+
+ getRatingVotes() as $_vote): ?>
+
+ getRatingCode() ?>
+
+
+
+
+
+
+
+ htmlEscape($_review->getDetail())) ?>
+ __('(Posted on %s)', $this->formatDate($_review->getCreatedAt()), 'long') ?>
+
+
+
+ getChildHtml('toolbar') ?>
+
+
+getChildHtml('review_form') ?>
diff --git a/app/design/frontend/default/blank/template/review/product/view/other.phtml b/app/design/frontend/default/blank/template/review/product/view/other.phtml
new file mode 100644
index 0000000000..5cb8a7890a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/product/view/other.phtml
@@ -0,0 +1,31 @@
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/review/view.phtml b/app/design/frontend/default/blank/template/review/view.phtml
new file mode 100644
index 0000000000..d9a0dccf78
--- /dev/null
+++ b/app/design/frontend/default/blank/template/review/view.phtml
@@ -0,0 +1,63 @@
+
+getProductData()->getId()): ?>
+
+
+
__('Review Details') ?>
+
+
+
+ getRating() && $this->getRating()->getSize()): ?>
+
__('Average Customer Rating') ?>:
+ getReviewsSummaryHtml($this->getProductData()) ?>
+
+
+
+
htmlEscape($this->getProductData()->getName()) ?>
+ getRating() && $this->getRating()->getSize()): ?>
+
__('Product Rating:') ?>
+
+ getRating() as $_rating): ?>
+ getPercent()): ?>
+ __($_rating->getRatingCode()) ?>
+
+
+
+
+
+
+
+
__('Product Review (submitted on %s):', $this->dateFormat($this->getReviewData()->getCreatedAt())) ?>
+
htmlEscape($this->getReviewData()->getDetail())) ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/rss/list.phtml b/app/design/frontend/default/blank/template/rss/list.phtml
new file mode 100644
index 0000000000..e6b4893308
--- /dev/null
+++ b/app/design/frontend/default/blank/template/rss/list.phtml
@@ -0,0 +1,84 @@
+
+
+
__('RSS Feeds') ?>
+
+getRssCatalogFeeds();
+ $_misc = $this->getRssMiscFeeds();
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+ __('There are no Rss Feeds'); ?>
+
diff --git a/app/design/frontend/default/blank/template/rss/nofeed.phtml b/app/design/frontend/default/blank/template/rss/nofeed.phtml
new file mode 100644
index 0000000000..f2a4a38b2f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/rss/nofeed.phtml
@@ -0,0 +1,27 @@
+
+There was no RSS feed enabled.
diff --git a/app/design/frontend/default/blank/template/rss/order/details.phtml b/app/design/frontend/default/blank/template/rss/order/details.phtml
new file mode 100644
index 0000000000..64e1c2a89f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/rss/order/details.phtml
@@ -0,0 +1,101 @@
+getStore()->getName()
+web site name = $_order->getStore()->getWebsite()->getName()
+store name = $_order->getStore()->getGroup()->getName()
+*/
+?>
+getOrder() ?>
+
+__('Customer Name: %s', $_order->getCustomerFirstname()?$_order->getCustomerName():$_order->getBillingAddress()->getName()) ?>
+__('Purchased From: %s', $_order->getStore()->getGroup()->getName()) ?>
+
+
+
+
+ Item
+ Qty
+ Subtotal
+
+
+
+
+getAllItems() as $_item): $i++ ?>
+ >
+ htmlEscape($_item->getName()) ?>
+ getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_item->getGiftMessageId())): ?>
+ __('Gift Message') ?>
+ __('From:'); ?> htmlEscape($_giftMessage->getSender()) ?>
+ __('To:'); ?> htmlEscape($_giftMessage->getRecipient()) ?>
+ __('Message:'); ?> htmlEscape($_giftMessage->getMessage()) ?>
+
+
+ getQtyOrdered()*1 ?>
+ formatPrice($_item->getRowTotal()) ?>
+
+
+
+
+
+ getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_order->getGiftMessageId())): ?>
+
+
+ __('Gift Message') ?>
+ __('From:'); ?> htmlEscape($_giftMessage->getSender()) ?>
+ __('To:'); ?> htmlEscape($_giftMessage->getRecipient()) ?>
+ __('Message:'); ?> htmlEscape($_giftMessage->getMessage()) ?>
+
+
+
+
+ __('Subtotal') ?>
+ formatPrice($_order->getSubtotal()) ?>
+
+ getDiscountAmount() > 0): ?>
+
+ __('Discount '.($_order->getCouponCode()?'('.$_order->getCouponCode().')':'')) ?>
+ formatPrice(0.00 - $_order->getDiscountAmount()) ?>
+
+
+ getShippingAmount() || $_order->getShippingDescription()): ?>
+
+ __('Shipping & Handling') ?>
+ formatPrice($_order->getShippingAmount()) ?>
+
+
+ getTaxAmount() > 0): ?>
+
+ __('Tax') ?>
+ formatPrice($_order->getTaxAmount()) ?>
+
+
+
+ __('Grand Total') ?>
+ formatPrice($_order->getGrandTotal()) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/sales/order/creditmemo.phtml b/app/design/frontend/default/blank/template/sales/order/creditmemo.phtml
new file mode 100644
index 0000000000..597a139892
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/creditmemo.phtml
@@ -0,0 +1,61 @@
+
+helper('giftmessage/message')->getIsMessagesAvailable('order', $this->getOrder())): ?>
+
+
+ getChildHtml('creditmemo_items') ?>
+
diff --git a/app/design/frontend/default/blank/template/sales/order/creditmemo/items.phtml b/app/design/frontend/default/blank/template/sales/order/creditmemo/items.phtml
new file mode 100644
index 0000000000..770d50f382
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/creditmemo/items.phtml
@@ -0,0 +1,65 @@
+
+getOrder() ?>
+__('Print All Refunds') ?>
+getCreditmemosCollection() as $_creditmemo): ?>
+__('Print Refund') ?>
+__('Refund #') ?>getIncrementId(); ?>
+__('Items Refunded') ?>
+
+
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+ __('Discount Amount') ?>
+ __('Row Total') ?>
+
+
+
+ getTotalsHtml($_creditmemo);?>
+
+ getAllItems(); ?>
+
+
+ getOrderItem()->getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/creditmemo/items/renderer/default.phtml b/app/design/frontend/default/blank/template/sales/order/creditmemo/items/renderer/default.phtml
new file mode 100644
index 0000000000..0410b7b8e5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/creditmemo/items/renderer/default.phtml
@@ -0,0 +1,298 @@
+
+getItem() ?>
+getItem()->getOrderItem()->getOrder() ?>
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item->getOrderItem()) && $_item->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+ splitInjection($this->getSku()) ?>
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getPrice()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getPriceInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+
+
+
+
+
+ getQty()*1 ?>
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
+
+
+
+ formatPrice(-$_item->getDiscountAmount()) ?>
+
+ formatPrice($_item->getRowTotal()-$_item->getDiscountAmount()+$_item->getTaxAmount()+$_item->getWeeeTaxAppliedRowAmount()) ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/sales/order/details.phtml b/app/design/frontend/default/blank/template/sales/order/details.phtml
new file mode 100644
index 0000000000..7b73195ae8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/details.phtml
@@ -0,0 +1,112 @@
+
+getOrder() ?>
+
+
__('My Orders - Details') ?>
+ __('Print All Invoices') ?>
+
+__('Order #%s', $_order->getRealOrderId()) ?>
+getInvoices() as $_invoice): ?>
+
+
__('Invoice #%s', $_invoice->getIncrementId()) ?>
+
__('Print Invoice') ?>
+
+
+
+
__('Shipping Address') ?>
+ getShippingAddress() ?>
+
getFirstname() ?> getLastname() ?>
+ getCompany() ?>
+ getStreet() ?>
+ getCity() ?>, getRegion() ?> getPostcode() ?>
+ T | getTelephone();
+ if($_shipping->getFax()): ?>
+ F | getFax() ?>
+
+
+
+
+
__('Billing Address') ?>
+ getbillingAddress() ?>
+
getFirstname() ?> getLastname() ?>
+ getCompany() ?>
+ getStreet() ?>
+ getCity() ?>, getRegion() ?> getPostcode() ?>
+ T | getTelephone();
+ if($_billing->getFax()): ?>
+ F | getFax() ?>
+
+
+
+
+
+
+
+
__('Shipping Method') ?>
+ getShippingMethod() ?> getShippingDescription() ?>
+
+
+
__('Payment Method') ?>
+ getPayment() ?>
+ getMethod() ?>: getCcType() ?> xxxxgetCcLast4() ?>
+
+
+
+__('Items Ordered') ?>
+
+
+
+ __('Product Name') ?>
+ __('Price') ?>
+ __('Qty Ordered') ?>
+ __('Qty Shipped') ?>
+ __('Subtotal') ?>
+
+
+
+ getItemsCollection(); ?>
+ count(); ?>
+
+
+ $_count ? ' class="last"' : '') ?>>
+ getProductName() ?>
+ formatPrice($_item->getPrice()*1) ?>
+ getQty()*1 ?>
+ getQty()*1 ?>
+ formatPrice($_item->getRowTotal()*1) ?>
+
+
+
+
+
+ __('Order Subtotal') ?>
+ formatPrice($_invoice->getSubtotal()) ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/history.phtml b/app/design/frontend/default/blank/template/sales/order/history.phtml
new file mode 100644
index 0000000000..5787abd11a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/history.phtml
@@ -0,0 +1,76 @@
+
+getMessagesBlock()->getGroupedHtml() ?>
+getOrders(); ?>
+
+
__('My Orders') ?>
+
+getPagerHtml(); ?>
+getSize()): ?>
+
+
+
+
+
+
+
+
+
+ __('Order #') ?>
+ __('Date') ?>
+ __('Ship to') ?>
+ __('Order Total') ?>
+ __('Order Status') ?>
+
+
+
+
+
+
+
+ getRealOrderId() ?>
+ formatDate($_order->getCreatedAtStoreDate()) ?>
+ getShippingAddress() ? $this->htmlEscape($_order->getShippingAddress()->getName()) : ' ' ?>
+ formatPrice($_order->getGrandTotal()) ?>
+ getStatusLabel() ?>
+
+ __('View Order') ?>
+ |__('Track Order') ?> */ ?>
+ helper('sales/reorder')->canReorder($_order)) : ?>
+ | __('Reorder') ?>
+
+
+
+
+
+
+
+
+getPagerHtml(); ?>
+
+ __('You have placed no orders.'); ?>
+
diff --git a/app/design/frontend/default/blank/template/sales/order/info.phtml b/app/design/frontend/default/blank/template/sales/order/info.phtml
new file mode 100644
index 0000000000..f674d93db5
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/info.phtml
@@ -0,0 +1,83 @@
+
+getOrder() ?>
+getMessagesBlock()->getGroupedHtml() ?>
+
+
__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?>
+ helper('rss/order')->isStatusNotificationAllow()): ?>
+
+
|
+
+ helper('sales/reorder')->canReorder($_order)) : ?>
+
__('Reorder') ?>
+
|
+
+
__('Print Order') ?>
+
+getStatusHistoryRssUrl($_order) ?>
+
+ __('About This Order:') ?>
+
+ getLinks(); ?>
+
+
+
+__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?>
+getIsVirtual()): ?>
+
+
+
__('Shipping Address') ?>
+
getShippingAddress()->format('html') ?>
+
+
+
__('Shipping Method') ?>__('Track Order') ?>*/ ?>
+ getShippingDescription()): ?>
+ getShippingDescription() ?>
+
+ helper('sales')->__('No shipping information available'); ?>
+
+
+
+
+
+
+
__('Billing Address') ?>
+
getBillingAddress()->format('html') ?>
+
+
+
__('Payment Method') ?>
+ getPaymentInfoHtml() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/sales/order/invoice.phtml b/app/design/frontend/default/blank/template/sales/order/invoice.phtml
new file mode 100644
index 0000000000..9ad0ac12b1
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/invoice.phtml
@@ -0,0 +1,61 @@
+
+helper('giftmessage/message')->getIsMessagesAvailable('order', $this->getOrder())): ?>
+
+
+getChildHtml('invoice_items') ?>
+
diff --git a/app/design/frontend/default/blank/template/sales/order/invoice/items.phtml b/app/design/frontend/default/blank/template/sales/order/invoice/items.phtml
new file mode 100644
index 0000000000..865ecacf4b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/invoice/items.phtml
@@ -0,0 +1,61 @@
+
+getOrder() ?>
+__('Print All Invoices') ?>
+getInvoiceCollection() as $_invoice): ?>
+__('Print Invoice') ?>
+__('Invoice #') ?>getIncrementId(); ?>
+__('Items Invoiced') ?>
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty Invoiced') ?>
+ __('Subtotal') ?>
+
+
+
+ getInvoiceTotalsHtml($_invoice)?>
+
+ getAllItems(); ?>
+
+
+ getOrderItem()->getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/invoice/items/renderer/default.phtml b/app/design/frontend/default/blank/template/sales/order/invoice/items/renderer/default.phtml
new file mode 100644
index 0000000000..c40bd0b596
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/invoice/items/renderer/default.phtml
@@ -0,0 +1,295 @@
+
+getItem() ?>
+getItem()->getOrderItem()->getOrder() ?>
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item->getOrderItem()) && $_item->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+ splitInjection($this->getSku()) ?>
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getPrice()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getPriceInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+
+
+
+
+
+ getQty()*1 ?>
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/items.phtml b/app/design/frontend/default/blank/template/sales/order/items.phtml
new file mode 100644
index 0000000000..5fdc1d2571
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/items.phtml
@@ -0,0 +1,69 @@
+
+getOrder() ?>
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+
+
+
+ getChildHtml('order_totals') ?>
+
+ getItemsCollection(); ?>
+
+ count(); ?>
+
+ getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
+
+ helper('giftmessage/message')->getGiftMessageForEntity($_item); ?>
+
+
+
+ __('From') ?> htmlEscape($_giftMessage->getRecipient()) ?>
+ __('To') ?> htmlEscape($_giftMessage->getSender()) ?>
+ helper('giftmessage/message')->getEscapedGiftMessage($_item) ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/sales/order/items/renderer/default.phtml b/app/design/frontend/default/blank/template/sales/order/items/renderer/default.phtml
new file mode 100644
index 0000000000..5c5e561b63
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/items/renderer/default.phtml
@@ -0,0 +1,317 @@
+
+getItem() ?>
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item) && $_item->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+ splitInjection($this->getSku()) ?>
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getPrice()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getPrice()+$this->getItem()->getWeeeTaxAppliedAmount()+$this->getItem()->getWeeeTaxDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getPriceInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedAmount()); ?>
+
+
+
+
+
+
+
+
+ getItem()->getQtyOrdered() > 0): ?>
+ __('Ordered'); ?>: getItem()->getQtyOrdered()*1 ?>
+
+ getItem()->getQtyShipped() > 0): ?>
+ __('Shipped'); ?>: getItem()->getQtyShipped()*1 ?>
+
+ getItem()->getQtyCanceled() > 0): ?>
+ __('Canceled'); ?>: getItem()->getQtyCanceled()*1 ?>
+
+ getItem()->getQtyRefunded() > 0): ?>
+ __('Refunded'); ?>: getItem()->getQtyRefunded()*1 ?>
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Excl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+ getOrder()->formatPrice($this->getItem()->getRowTotal()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total'); ?>: getOrder()->formatPrice($this->getItem()->getRowTotal()+$this->getItem()->getWeeeTaxAppliedRowAmount()+$this->getItem()->getWeeeTaxRowDisposition()); ?>
+
+
+
+
+
+
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
+
+ helper('tax')->displaySalesBothPrices()): ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+ __('Incl. Tax'); ?>:
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+ helper('checkout')->getSubtotalInclTax($this->getItem()); ?>
+ typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+
+
+
+ typeOfDisplay($this->getItem(), array(0, 1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+ getOrder()->formatPrice($_incl-$this->getItem()->getWeeeTaxRowDisposition()) ?>
+
+
+
+
+
+ getApplied($this->getItem())): ?>
+
+
+ typeOfDisplay($this->getItem(), 1, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount']); ?>
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+ typeOfDisplay($this->getItem(), 4, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ getApplied($this->getItem()) as $tax): ?>
+ : getOrder()->formatPrice($tax['row_amount_incl_tax']); ?>
+
+
+
+
+
+ typeOfDisplay($this->getItem(), 2, 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
+
+ __('Total incl. tax'); ?>: getOrder()->formatPrice($_incl+$this->getItem()->getWeeeTaxAppliedRowAmount()); ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/sales/order/print.phtml b/app/design/frontend/default/blank/template/sales/order/print.phtml
new file mode 100644
index 0000000000..d013e874b2
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/print.phtml
@@ -0,0 +1,85 @@
+
+getOrder() ?>
+__('Order #%s', $_order->getRealOrderId()) ?>
+__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?>
+
+ getIsVirtual()): ?>
+
+
__('Shipping Address') ?>
+
getShippingAddress()->format('html') ?>
+
+
+
+
+
+
__('Billing Address') ?>
+
getBillingAddress()->format('html') ?>
+
+getIsVirtual()): ?>
+
+
+
+
__('Shipping Method') ?>
+ getShippingDescription() ?>
+
+
+
+
__('Payment Method') ?>
+ getPaymentInfoHtml() ?>
+
+
+
__('Items Ordered') ?>
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+
+
+
+ getChildHtml('order_totals') ?>
+
+ getItemsCollection(); ?>
+ count(); ?>
+
+ getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/print/creditmemo.phtml b/app/design/frontend/default/blank/template/sales/order/print/creditmemo.phtml
new file mode 100644
index 0000000000..abb348dd92
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/print/creditmemo.phtml
@@ -0,0 +1,101 @@
+
+getOrder() ?>
+
__('Order #%s', $_order->getRealOrderId()) ?>
+
__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?>
+getCreditmemo() ?>
+
+
+
+ getCreditmemosCollection() ?>
+
+
+
+
__('Refund #%s', $_creditmemo->getIncrementId()) ?>
+
+
+
+ getIsVirtual()): ?>
+
__('Shipping Address') ?>
+ getShippingAddress() ?>
+
format('html') ?>
+
+
+
+
__('Billing Address') ?>
+ getbillingAddress() ?>
+
getBillingAddress()->format('html') ?>
+
+ getIsVirtual()): ?>
+
+
+
+
__('Shipping Method') ?>
+ getShippingDescription() ?>
+
+
+
+
__('Payment Method') ?>
+ getPaymentInfoHtml() ?>
+
+
+
+
__('Items Refunded') ?>
+
+
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty') ?>
+ __('Subtotal') ?>
+ __('Discount Amount') ?>
+ __('Row Total') ?>
+
+
+
+ getTotalsHtml($_creditmemo);?>
+
+ getAllItems(); ?>
+
+
+ getOrderItem()->getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/print/invoice.phtml b/app/design/frontend/default/blank/template/sales/order/print/invoice.phtml
new file mode 100644
index 0000000000..669a99d1b6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/print/invoice.phtml
@@ -0,0 +1,99 @@
+
+getOrder() ?>
+
__('Order #%s', $_order->getRealOrderId()) ?>
+
__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?>
+getInvoice() ?>
+
+
+
+ getInvoiceCollection() ?>
+
+
+
+
__('Invoice #%s', $_invoice->getIncrementId()) ?>
+
+
+
+ getIsVirtual()): ?>
+
__('Shipping Address') ?>
+ getShippingAddress() ?>
+
format('html') ?>
+
+
+
+
__('Billing Address') ?>
+ getbillingAddress() ?>
+
getBillingAddress()->format('html') ?>
+
+ getIsVirtual()): ?>
+
+
+
+
+
__('Shipping Method') ?>
+ getShippingDescription() ?>
+
+
+
+
__('Payment Method') ?>
+ getPaymentInfoHtml() ?>
+
+
+
+
__('Items Invoiced') ?>
+
+
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty Invoiced') ?>
+ __('Subtotal') ?>
+
+
+
+
+ getInvoiceTotalsHtml($_invoice)?>
+
+ getItemsCollection(); ?>
+ count(); ?>
+
+ getOrderItem()->getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/print/shipment.phtml b/app/design/frontend/default/blank/template/sales/order/print/shipment.phtml
new file mode 100644
index 0000000000..9903aa6368
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/print/shipment.phtml
@@ -0,0 +1,89 @@
+
+getOrder() ?>
+
__('Order #%s', $_order->getRealOrderId()) ?>
+
__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?>
+getIsVirtual()): ?>
+getShipment() ?>
+
+
+
+ getShipmentsCollection() ?>
+
+
+
+
__('Shipment #%s', $_shipment->getIncrementId()) ?>
+
+
+
+
__('Shipping Address') ?>
+ getShippingAddress() ?>
+
format('html') ?>
+
+
+
__('Billing Address') ?>
+ getbillingAddress() ?>
+
getBillingAddress()->format('html') ?>
+
+
+
+
+
+
__('Shipping Method') ?>
+ getShippingDescription() ?>
+
+
+
__('Payment Method') ?>
+ getPaymentInfoHtml() ?>
+
+
+
+
__('Items Shipped') ?>
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Qty Shipped') ?>
+
+
+ getItemsCollection(); ?>
+
+
+ getOrderItem()->getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/recent.phtml b/app/design/frontend/default/blank/template/sales/order/recent.phtml
new file mode 100644
index 0000000000..a22511f5bf
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/recent.phtml
@@ -0,0 +1,75 @@
+
+
+getOrders(); ?>
+
+getItems()) > 0 ): ?>
+
+
+
+
+
+
+
+
+
+ __('Order #') ?>
+ __('Date') ?>
+ __('Ship to') ?>
+ __('Order Total') ?>
+ __('Status') ?>
+
+
+
+
+
+
+ getRealOrderId() ?>
+ formatDate($_order->getCreatedAtStoreDate()) ?>
+ getShippingAddress() ? $this->htmlEscape($_order->getShippingAddress()->getName()) : ' ' ?>
+ formatPrice($_order->getGrandTotal()) ?>
+ getStatusLabel() ?>
+
+
+ __('View Order') ?>
+ helper('sales/reorder')->canReorder($_order)) : ?>
+ | __('Reorder') ?>
+
+
+
+
+
+
+
+
+
+
__('You have placed no orders.'); ?>
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/shipment.phtml b/app/design/frontend/default/blank/template/sales/order/shipment.phtml
new file mode 100644
index 0000000000..5dd9358788
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/shipment.phtml
@@ -0,0 +1,61 @@
+
+helper('giftmessage/message')->getIsMessagesAvailable('order', $this->getOrder())): ?>
+
+
+ getChildHtml('shipment_items') ?>
+
diff --git a/app/design/frontend/default/blank/template/sales/order/shipment/items.phtml b/app/design/frontend/default/blank/template/sales/order/shipment/items.phtml
new file mode 100644
index 0000000000..c6fb35491b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/shipment/items.phtml
@@ -0,0 +1,86 @@
+
+getOrder() ?>
+
+ getTracksCollection()->count()) : ?>
+ __('Track all shipments') ?> |
+
+ __('Print All Shipments') ?>
+
+getShipmentsCollection() as $_shipment): ?>
+
__('Print Shipment') ?>
+
__('Shipment #') ?>getIncrementId(); ?>
+getTracksCollection(); ?>
+count()): ?>
+
+
+
__('Items Shipped') ?>
+
+
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Qty Shipped') ?>
+
+
+ getAllItems(); ?>
+
+
+ getOrderItem()->getParentItem()) continue; ?>
+
+ getItemHtml($_item) ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/order/shipment/items/renderer/default.phtml b/app/design/frontend/default/blank/template/sales/order/shipment/items/renderer/default.phtml
new file mode 100644
index 0000000000..678fd745dc
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/shipment/items/renderer/default.phtml
@@ -0,0 +1,61 @@
+
+getItem() ?>
+getItem()->getOrderItem()->getOrder() ?>
+
+ htmlEscape($_item->getName()) ?>
+ getItemOptions()): ?>
+
+
+ htmlEscape($_option['label']) ?>
+ getPrintStatus()): ?>
+ getFormatedOptionValue($_option) ?>
+ class="truncated">
+
+
+
+
+ htmlEscape($_option['label']) ?>
+
+
+
+
+
+
+ htmlEscape( (isset($_option['print_value']) ? $_option['print_value'] : $_option['value']) ) ?>
+
+
+
+
+ getDescription() ?>
+ helper('giftmessage/message')->getIsMessagesAvailable('order_item', $_item->getOrderItem()) && $_item->getGiftMessageId()): ?>
+ __('Gift Message') ?>
+
+
+ splitInjection($this->getSku()) ?>
+ getQty()*1 ?>
+
diff --git a/app/design/frontend/default/blank/template/sales/order/totals.phtml b/app/design/frontend/default/blank/template/sales/order/totals.phtml
new file mode 100644
index 0000000000..3b12cc4416
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/totals.phtml
@@ -0,0 +1,52 @@
+
+getTotals() as $_code => $_total): ?>
+ getBlockName()): ?>
+ getChildHtml($_total->getBlockName(), false); ?>
+
+
+ getLabelProperties()?>>
+ getStrong()):?>
+ getLabel()?>
+
+ getLabel()?>
+
+
+ getValueProperties()?>>
+ getStrong()):?>
+ formatValue($_total) ?>
+
+ formatValue($_total) ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/sales/order/trackinginfo.phtml b/app/design/frontend/default/blank/template/sales/order/trackinginfo.phtml
new file mode 100644
index 0000000000..a877f02a06
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/trackinginfo.phtml
@@ -0,0 +1,68 @@
+
+
+
+trackingInfo): ?>
+
+ trackingInfo->getCarrierTitle() ?> - trackingInfo->getTracking() ?>
+
+ trackingInfo->getErrorMessage()): ?>
+ trackingInfo->getErrorMessage() ?>
+
+ trackingInfo->getUrl()): ?>
+ Please, visit for more info:
trackingInfo->getCarrierTitle() ?>
+
+
+ trackingInfo->getStatus()): ?>
+ Status: trackingInfo->getStatus() ?>
+
+
+ trackingInfo->getDeliverydate()): ?>
+ Delivery Date: trackingInfo->getDeliverydate() ?>
+
+
+ trackingInfo->getDeliverytime()): ?>
+ Delivery Time: trackingInfo->getDeliverytime() ?>
+
+
+ trackingInfo->getDeliverylocation()): ?>
+ Delivery Location: trackingInfo->getDeliverylocation() ?>
+
+
+ trackingInfo->getSignedby()): ?>
+ Signed by: trackingInfo->getSignedby() ?>
+
+
+ trackingInfo->getTrackSummary()): ?>
+ Tracking summary: trackingInfo->getTrackSummary() ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/sales/order/view.phtml b/app/design/frontend/default/blank/template/sales/order/view.phtml
new file mode 100644
index 0000000000..e60e1c07dc
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/order/view.phtml
@@ -0,0 +1,86 @@
+
+helper('giftmessage/message')->getIsMessagesAvailable('items', $this->getOrder())): ?>
+
+
+getOrder() ?>
+
__('Items Ordered') ?>
+ getTracksCollection()->count()) : ?>
+ | __('Track your order') ?>
+
+
+
+getChildHtml('order_items') ?>
+
+helper('giftmessage/message')->getIsMessagesAvailable('order', $_order) && $_order->getGiftMessageId()): ?>
+
__('Gift Message for this Order') ?>
+ helper('giftmessage/message')->getGiftMessageForEntity($_order); ?>
+
+ __('From') ?> htmlEscape($_giftMessage->getSender()) ?>
+ __('To') ?> htmlEscape($_giftMessage->getRecipient()) ?>
+ helper('giftmessage/message')->getEscapedGiftMessage($_order) ?>
+
+
+getOrder()->getVisibleStatusHistory() ?>
+
+
__('About Your Order') ?>
+
+
+ formatDate($_historyItem->getCreatedAtStoreDate(), 'medium', true) ?>
+ getComment() ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/sales/reorder/sidebar.phtml b/app/design/frontend/default/blank/template/sales/reorder/sidebar.phtml
new file mode 100644
index 0000000000..01abfd2452
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sales/reorder/sidebar.phtml
@@ -0,0 +1,79 @@
+
+
+getLastOrder()): ?>
+
+
+
+
__('Last ordered items') ?>
+
+
+
+
+
+
+
+ __('Add to Cart') ?>
+
+
+
+
+
+
+getPagerHtml(); ?>
+
+
diff --git a/app/design/frontend/default/blank/template/sendfriend/send.phtml b/app/design/frontend/default/blank/template/sendfriend/send.phtml
new file mode 100644
index 0000000000..9858842d19
--- /dev/null
+++ b/app/design/frontend/default/blank/template/sendfriend/send.phtml
@@ -0,0 +1,129 @@
+
+
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
__('Email to a Friend') ?>
+
+
+getBlockHtml('formkey')?>
+
+ __('Sender:') ?>
+
+
+
+ __('Recipient:') ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/shipping/tracking/ajax.phtml b/app/design/frontend/default/blank/template/shipping/tracking/ajax.phtml
new file mode 100644
index 0000000000..ecbe3473a8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/shipping/tracking/ajax.phtml
@@ -0,0 +1,26 @@
+
diff --git a/app/design/frontend/default/blank/template/shipping/tracking/popup.phtml b/app/design/frontend/default/blank/template/shipping/tracking/popup.phtml
new file mode 100644
index 0000000000..38e6d7c4a1
--- /dev/null
+++ b/app/design/frontend/default/blank/template/shipping/tracking/popup.phtml
@@ -0,0 +1,167 @@
+
+getTrackingInfo() ?>
+
+ __('Close Window') ?>
+
+0): ?>
+ $_result): ?>
+
+
__('Shipment #').$shipid; ?>
+
+ 0): ?>
+
+
+
+
+
+ __('Tracking Number:'); ?>
+ getTracking(); ?>
+
+ getCarrierTitle()): ?>
+
+ __('Carrier:'); ?>
+ getCarrierTitle(); ?>
+
+
+ getErrorMessage()): ?>
+
+ __('Error:'); ?>
+ __('Tracking information is currently not available. Please ') ?>__('contact us') ?> __(' for more information or email us at '); ?>getStoreSupportEmail() ?>
+
+ getTrackSummary()): ?>
+
+ __('Info:'); ?>
+ getTrackSummary(); ?>
+
+ getUrl()): ?>
+
+ __('Track:'); ?>
+ getUrl(); ?>
+
+
+ getStatus()): ?>
+
+ __('Status:'); ?>
+ getStatus(); ?>
+
+
+
+ getDeliverydate()): ?>
+
+ __('Delivered on:'); ?>
+ formatDeliveryDateTime($track->getDeliverydate(),$track->getDeliverytime()); ?>
+
+
+
+ getSignedby()): ?>
+
+ __('Signed by:'); ?>
+ getSignedby(); ?>
+
+
+
+ getDeliveryLocation()): ?>
+
+ __('Delivered to:'); ?>
+ getDeliveryLocation(); ?>
+
+
+
+ getShippedDate()): ?>
+
+ __('Shipped or billed on:'); ?>
+ getShippedDate(); ?>
+
+
+
+ getService()): ?>
+
+ __('Service Type:'); ?>
+ getService(); ?>
+
+
+
+ getWeight()): ?>
+
+ __('Weight:'); ?>
+ getWeight(); ?>
+
+
+
+
+
+
+
+ __('N/A')); ?>:
+
+
+
+
+
+ getProgressdetail())>0): ?>
+
+
+
+
+ __('Location') ?>
+ __('Date') ?>
+ __('Local Time') ?>
+ __('Description') ?>
+
+
+ getProgressdetail() as $_detail): ?>
+ formatDeliveryDate($_detail['deliverydate']) : '') ?>
+ formatDeliveryTime($_detail['deliverytime'], $_detailDate) : '') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__('There is no tracking available for this shipment.'); ?>
+
+
+
+
+
__('There is no tracking available.'); ?>
+
+
+ __('Close Window') ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/tag/cloud.phtml b/app/design/frontend/default/blank/template/tag/cloud.phtml
new file mode 100644
index 0000000000..9340a17322
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/cloud.phtml
@@ -0,0 +1,38 @@
+
+
+
__('All Tags') ?>
+
+getTags()) > 0 ): ?>
+
+
+
__("Tags Aren't Available") ?>
+
diff --git a/app/design/frontend/default/blank/template/tag/customer/edit.phtml b/app/design/frontend/default/blank/template/tag/customer/edit.phtml
new file mode 100644
index 0000000000..2e5db2f4bd
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/customer/edit.phtml
@@ -0,0 +1,45 @@
+
+
+
__('Edit Tag') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
+ __('Tag Information') ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/tag/customer/recent.phtml b/app/design/frontend/default/blank/template/tag/customer/recent.phtml
new file mode 100644
index 0000000000..fe3c73329c
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/customer/recent.phtml
@@ -0,0 +1,49 @@
+
+
diff --git a/app/design/frontend/default/blank/template/tag/customer/tags.phtml b/app/design/frontend/default/blank/template/tag/customer/tags.phtml
new file mode 100644
index 0000000000..89ee30097e
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/customer/tags.phtml
@@ -0,0 +1,43 @@
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
__('My Tags') ?>
+
+getTags()): ?>
+
__('Click on a tag to view your corresponding products.') ?>
+
+
+
__('You have not tagged any products yet.') ?>
+
+
diff --git a/app/design/frontend/default/blank/template/tag/customer/view.phtml b/app/design/frontend/default/blank/template/tag/customer/view.phtml
new file mode 100644
index 0000000000..0ff9bdd3ed
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/customer/view.phtml
@@ -0,0 +1,75 @@
+
+
+
__('My Tags') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+ __('Tag Name: %s', $this->htmlEscape($this->getTagInfo()->getName())) ?>
+ ( __('Edit Tag') ?>
+ |
+ __('Delete Tag') ?> )
+
+getToolbarHtml() ?>
+
+
+getToolbarHtml() ?>
+
diff --git a/app/design/frontend/default/blank/template/tag/list.phtml b/app/design/frontend/default/blank/template/tag/list.phtml
new file mode 100644
index 0000000000..7b4035dbdc
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/list.phtml
@@ -0,0 +1,58 @@
+
+
diff --git a/app/design/frontend/default/blank/template/tag/mytags.phtml b/app/design/frontend/default/blank/template/tag/mytags.phtml
new file mode 100644
index 0000000000..9fc1f7a102
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/mytags.phtml
@@ -0,0 +1,75 @@
+
+
+
+getItems() as $tag) { /* $tag = $tag->getData();*/ ?>
+
+ getTagname(); ?>
+
+ e
+ d
+
+
+
diff --git a/app/design/frontend/default/blank/template/tag/popular.phtml b/app/design/frontend/default/blank/template/tag/popular.phtml
new file mode 100644
index 0000000000..3c7e70fc8d
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/popular.phtml
@@ -0,0 +1,41 @@
+
+
diff --git a/app/design/frontend/default/blank/template/tag/product/result.phtml b/app/design/frontend/default/blank/template/tag/product/result.phtml
new file mode 100644
index 0000000000..07465fc2c6
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/product/result.phtml
@@ -0,0 +1,65 @@
+
+getTagInfo()->getName() ): ?>
+
+
__("Products tagged with '%s'", $this->htmlEscape($this->getTagInfo()->getName())) ?>
+
+
+getListHtml() ?>
+
+
+getListHtml() ?>
diff --git a/app/design/frontend/default/blank/template/tag/result.phtml b/app/design/frontend/default/blank/template/tag/result.phtml
new file mode 100644
index 0000000000..6df0735cff
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/result.phtml
@@ -0,0 +1,41 @@
+
+
+
__("Search Results for '%s' (RSS )", $query, '/taggedproducts/xml/?tag='.$query) ?>
+
+
diff --git a/app/design/frontend/default/blank/template/tag/search.phtml b/app/design/frontend/default/blank/template/tag/search.phtml
new file mode 100644
index 0000000000..9298b4e9a3
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tag/search.phtml
@@ -0,0 +1,42 @@
+
+
+
__("Products tagged with '%s' (RSS )", $query, '/tag/index/xml?tag='.$query) ?>
+
+
+
+
+
+
+ Tags:
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/tax/checkout/discount.phtml b/app/design/frontend/default/blank/template/tax/checkout/discount.phtml
new file mode 100644
index 0000000000..9fe80408a7
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tax/checkout/discount.phtml
@@ -0,0 +1,25 @@
+
+includeTax() && $this->getTotalExclTax()>=0):?>
+
+
+ helper('tax')->__('Grand Total Excl. Tax')?>
+
+
+ helper('checkout')->formatPrice($this->getTotalExclTax()) ?>
+
+
+renderTotals('taxes', $this->getColspan()); ?>
+
+
+ helper('tax')->__('Grand Total Incl. Tax')?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
+
+
+
+
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/tax/checkout/shipping.phtml b/app/design/frontend/default/blank/template/tax/checkout/shipping.phtml
new file mode 100644
index 0000000000..ea4a273cfb
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tax/checkout/shipping.phtml
@@ -0,0 +1,66 @@
+
+displayBoth()):?>
+
+
+ getExcludeTaxLabel() ?>
+
+
+ helper('checkout')->formatPrice($this->getShippingExcludeTax()) ?>
+
+
+
+
+ getIncludeTaxLabel() ?>
+
+
+ helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
+
+
+displayIncludeTax()) : ?>
+
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($this->getShippingIncludeTax()) ?>
+
+
+
+
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($this->getShippingExcludeTax()) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/tax/checkout/subtotal.phtml b/app/design/frontend/default/blank/template/tax/checkout/subtotal.phtml
new file mode 100644
index 0000000000..6a3f4f664a
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tax/checkout/subtotal.phtml
@@ -0,0 +1,57 @@
+
+displayBoth()):?>
+
+
+ helper('tax')->__('Subtotal (Excl. Tax)') ?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValueExclTax()) ?>
+
+
+
+
+ helper('tax')->__('Subtotal (Incl. Tax)') ?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValueInclTax()) ?>
+
+
+
+
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/tax/checkout/tax.phtml b/app/design/frontend/default/blank/template/tax/checkout/tax.phtml
new file mode 100644
index 0000000000..027ac335b4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tax/checkout/tax.phtml
@@ -0,0 +1,74 @@
+
+getTotal()->getValue();
+ $_style = $this->getTotal()->getStyle();
+?>
+
+helper('tax')->displayFullSummary() && $_value!=0): ?>
+
+ getTotal()->getFullInfo() as $info): ?>
+
+
+
+
+
+
+
+
+
+
+
+ (%)
+
+
+
+
+
+ helper('checkout')->formatPrice($amount); ?>
+
+
+
+
+
+
+
+
+
helper('tax')->displayFullSummary() && $_value!=0): ?> class="tax-total" onclick="expandDetails(this, '.tax-details-')">
+
+ helper('tax')->displayFullSummary()): ?>
+ getTotal()->getTitle() ?>
+
+ getTotal()->getTitle() ?>
+
+
+ helper('checkout')->formatPrice($_value) ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/tax/order/tax.phtml b/app/design/frontend/default/blank/template/tax/order/tax.phtml
new file mode 100644
index 0000000000..5d6988791b
--- /dev/null
+++ b/app/design/frontend/default/blank/template/tax/order/tax.phtml
@@ -0,0 +1,81 @@
+
+getOrder();
+ $_source = $this->getSource();
+ $_fullInfo = $_source->getFullTaxInfo();
+ global $taxIter; $taxIter++;
+?>
+
+
+displayFullSummary()): ?>
+
+
+
+
+
+
getIsPlaneMode()):?> style="display:none;">
+ getLabelProperties()?>>
+
+
+ (%)
+
+
+
+
+ getValueProperties()?> rowspan="">
+ formatPrice($amount); ?>
+
+
+
+
+
+
+
+
+
+displayFullSummary() && $_fullInfo && !$this->getIsPlaneMode()): ?>
+
+displayFullSummary() && $_fullInfo && $this->getIsPlaneMode()): ?>
+
+
+
+
+ getLabelProperties()?>>
+ displayFullSummary()): ?>
+ __('Tax'); ?>
+
+ __('Tax'); ?>
+
+
+ getValueProperties()?>>formatPrice($_source->getTaxAmount()) ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/wishlist/email/items.phtml b/app/design/frontend/default/blank/template/wishlist/email/items.phtml
new file mode 100644
index 0000000000..a8742c47f4
--- /dev/null
+++ b/app/design/frontend/default/blank/template/wishlist/email/items.phtml
@@ -0,0 +1,53 @@
+
+getWishlistItemsCount() ?>
+
diff --git a/app/design/frontend/default/blank/template/wishlist/email/rss.phtml b/app/design/frontend/default/blank/template/wishlist/email/rss.phtml
new file mode 100644
index 0000000000..b7ec4b1401
--- /dev/null
+++ b/app/design/frontend/default/blank/template/wishlist/email/rss.phtml
@@ -0,0 +1,31 @@
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/wishlist/shared.phtml b/app/design/frontend/default/blank/template/wishlist/shared.phtml
new file mode 100644
index 0000000000..52e52fe2e8
--- /dev/null
+++ b/app/design/frontend/default/blank/template/wishlist/shared.phtml
@@ -0,0 +1,75 @@
+
+
+
htmlEscape($this->getHeader()) ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+hasWishlistItems()): ?>
+
+
+
+
+
+
+
+ __('Product') ?>
+ __('Comment') ?>
+
+
+
+
+ getWishlistItems() as $item): ?>
+
+
+
+
+
+
+ getPriceHtml($item) ?>
+
+ getEscapedDescription($item) ?>
+
+ isSaleable()): ?>
+ __('Add to Cart') ?>
+
+ __('Add to Wishlist') ?>
+
+
+
+
+
+
+ isSaleable()):?>
+
+ __('Add All to Cart') ?>
+
+
+
+
+
__('Wishlist is empty now.') ?>
+
\ No newline at end of file
diff --git a/app/design/frontend/default/blank/template/wishlist/sharing.phtml b/app/design/frontend/default/blank/template/wishlist/sharing.phtml
new file mode 100644
index 0000000000..52dad3df51
--- /dev/null
+++ b/app/design/frontend/default/blank/template/wishlist/sharing.phtml
@@ -0,0 +1,80 @@
+
+
+
__('Share Your Wishlist') ?>
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+
+ getBlockHtml('formkey')?>
+ __('Sharing Information') ?>
+
+ __('* Required Fields') ?>
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/wishlist/sidebar.phtml b/app/design/frontend/default/blank/template/wishlist/sidebar.phtml
new file mode 100644
index 0000000000..3359c6436f
--- /dev/null
+++ b/app/design/frontend/default/blank/template/wishlist/sidebar.phtml
@@ -0,0 +1,63 @@
+
+helper('wishlist')->isAllow()) : ?>
+
+
+
__('My Wishlist - %d Item(s) ',
+ $this->helper('wishlist')->getListUrl(),
+ $this->helper('wishlist')->getItemCount()
+ ) ?>
+
+
+
__('Last Added Items') ?>
+ hasWishlistItems()): ?>
+
+
+
+
__('You have no items in your wishlist.') ?>
+
+
+
+
+
diff --git a/app/design/frontend/default/blank/template/wishlist/view.phtml b/app/design/frontend/default/blank/template/wishlist/view.phtml
new file mode 100644
index 0000000000..672fbf6482
--- /dev/null
+++ b/app/design/frontend/default/blank/template/wishlist/view.phtml
@@ -0,0 +1,111 @@
+
+getMessagesBlock()->getGroupedHtml() ?>
+
+ helper('wishlist')->isRssAllow() && $this->hasWishlistItems()): ?>
+
+
+
__('My Wishlist') ?>
+
+
+hasWishlistItems()): ?>
+
+
+ getBlockHtml('formkey')?>
+
+
+
+
+
+
+
+
+ __('Product') ?>
+ __('Comment') ?>
+ __('Added On') ?>
+ __('Add to Cart') ?>
+
+
+
+
+ getWishlistItems() as $item): ?>
+
+
+
+
+ getPriceHtml($item) ?>
+
+
+ hasDescription($item) ? $this->getEscapedDescription($item) : $this->helper('wishlist')->defaultCommentString() ?>
+
+
+ getFormatedDate($item->getAddedAt()) ?>
+
+
+ isSaleable()): ?>
+ __('Add to Cart') ?>
+
+
+
+
+
+
+
+
+
+
+
+ __('Share Wishlist') ?>
+ isSaleable()):?>
+ __('Add All to Cart') ?>
+
+ __('Update Wishlist') ?>
+
+
+
+
+
__('You have no items in your wishlist.') ?>
+
+
+
diff --git a/app/design/frontend/default/default/layout/catalog.xml b/app/design/frontend/default/default/layout/catalog.xml
index 0e2db373f1..69e819235d 100644
--- a/app/design/frontend/default/default/layout/catalog.xml
+++ b/app/design/frontend/default/default/layout/catalog.xml
@@ -56,7 +56,7 @@ Default layout, loads most of the pages
-
+
@@ -157,7 +157,7 @@ Compare products page
- catalog_compare_sidebar
+ catalog.compare.sidebar
diff --git a/app/design/frontend/default/default/layout/chronopay.xml b/app/design/frontend/default/default/layout/chronopay.xml
new file mode 100644
index 0000000000..cd0df88a88
--- /dev/null
+++ b/app/design/frontend/default/default/layout/chronopay.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/layout/customer.xml b/app/design/frontend/default/default/layout/customer.xml
index d526cf54af..aa01cc5684 100644
--- a/app/design/frontend/default/default/layout/customer.xml
+++ b/app/design/frontend/default/default/layout/customer.xml
@@ -189,7 +189,7 @@ Customer account pages, rendered for all tabs in dashboard
grouped checkout/cart_item_renderer_grouped checkout/cart/sidebar/default.phtml
configurable checkout/cart_item_renderer_configurable checkout/cart/sidebar/default.phtml
-
+
diff --git a/app/design/frontend/default/default/layout/cybermut.xml b/app/design/frontend/default/default/layout/cybermut.xml
new file mode 100644
index 0000000000..4ff5d146d2
--- /dev/null
+++ b/app/design/frontend/default/default/layout/cybermut.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/layout/eway.xml b/app/design/frontend/default/default/layout/eway.xml
new file mode 100644
index 0000000000..1b8ddc9651
--- /dev/null
+++ b/app/design/frontend/default/default/layout/eway.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/layout/ideal.xml b/app/design/frontend/default/default/layout/ideal.xml
new file mode 100644
index 0000000000..30caf0fdd8
--- /dev/null
+++ b/app/design/frontend/default/default/layout/ideal.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/layout/oscommerce.xml b/app/design/frontend/default/default/layout/oscommerce.xml
new file mode 100644
index 0000000000..d6c695dcb4
--- /dev/null
+++ b/app/design/frontend/default/default/layout/oscommerce.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/default/layout/paybox.xml b/app/design/frontend/default/default/layout/paybox.xml
new file mode 100644
index 0000000000..f0076f1603
--- /dev/null
+++ b/app/design/frontend/default/default/layout/paybox.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/layout/protx.xml b/app/design/frontend/default/default/layout/protx.xml
new file mode 100644
index 0000000000..fd7d357378
--- /dev/null
+++ b/app/design/frontend/default/default/layout/protx.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ page/2columns-right.phtml
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/layout/sales.xml b/app/design/frontend/default/default/layout/sales.xml
index 322e4cc6aa..1317ca78f7 100644
--- a/app/design/frontend/default/default/layout/sales.xml
+++ b/app/design/frontend/default/default/layout/sales.xml
@@ -85,7 +85,11 @@ Customer account home dashboard layout
default sales/order_item_renderer_default sales/order/items/renderer/default.phtml
grouped sales/order_item_renderer_grouped sales/order/items/renderer/default.phtml
-
+
+ colspan="4" class="a-right"
+ class="last a-right"
+
+
@@ -105,6 +109,11 @@ Customer account home dashboard layout
default sales/order_item_renderer_default sales/order/invoice/items/renderer/default.phtml
grouped sales/order_item_renderer_grouped sales/order/invoice/items/renderer/default.phtml
+
+ colspan="4" class="a-right"
+ class="last a-right"
+
+
@@ -142,6 +151,11 @@ Customer account home dashboard layout
default sales/order_item_renderer_default sales/order/creditmemo/items/renderer/default.phtml
grouped sales/order_item_renderer_grouped sales/order/creditmemo/items/renderer/default.phtml
+
+ colspan="6" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+
@@ -165,7 +179,13 @@ Customer account home dashboard layout
default sales/order_item_renderer_default sales/order/items/renderer/default.phtml
grouped sales/order_item_renderer_grouped sales/order/items/renderer/default.phtml
-
+
+ colspan="4" class="a-right"
+ class="last a-right"
+
+ 1
+
+
@@ -175,6 +195,11 @@ Customer account home dashboard layout
default sales/order_item_renderer_default sales/order/invoice/items/renderer/default.phtml
grouped sales/order_item_renderer_grouped sales/order/invoice/items/renderer/default.phtml
+
+ colspan="4" class="a-right"
+ class="last a-right"
+
+
@@ -192,6 +217,11 @@ Customer account home dashboard layout
default sales/order_item_renderer_default sales/order/creditmemo/items/renderer/default.phtml
grouped sales/order_item_renderer_grouped sales/order/creditmemo/items/renderer/default.phtml
+
+ colspan="6" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+
@@ -203,13 +233,25 @@ Email layouts section
default sales/order_email_items_order_default email/order/items/order/default.phtml
grouped sales/order_email_items_order_grouped email/order/items/order/default.phtml
+
+ colspan="3" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+ 1
+
+
default sales/order_email_items_default email/order/items/invoice/default.phtml
- grouped sales/order_email_items_grouped email/order/items/invoice/default.phtml
+ grouped sales/order_email_items_order_grouped email/order/items/invoice/default.phtml
+
+ colspan="3" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+
@@ -222,7 +264,12 @@ Email layouts section
default sales/order_email_items_default email/order/items/creditmemo/default.phtml
- grouped sales/order_email_items_grouped email/order/items/creditmemo/default.phtml
+ grouped sales/order_email_items_order_grouped email/order/items/creditmemo/default.phtml
+
+ colspan="3" align="right" style="padding:3px 9px"
+ align="right" style="padding:3px 9px"
+
+
diff --git a/app/design/frontend/default/default/template/amazonpayments/asp/form.phtml b/app/design/frontend/default/default/template/amazonpayments/asp/form.phtml
index 059143759a..f9e95a3fc8 100644
--- a/app/design/frontend/default/default/template/amazonpayments/asp/form.phtml
+++ b/app/design/frontend/default/default/template/amazonpayments/asp/form.phtml
@@ -29,7 +29,7 @@
$_code=$this->getMethodCode() ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/amazonpayments/asp/redirect.phtml b/app/design/frontend/default/default/template/amazonpayments/asp/redirect.phtml
index 3fdb3f0a20..6b8e98fbad 100644
--- a/app/design/frontend/default/default/template/amazonpayments/asp/redirect.phtml
+++ b/app/design/frontend/default/default/template/amazonpayments/asp/redirect.phtml
@@ -26,11 +26,11 @@
?>
- __('You will be redirected to Amazon Simple Pay in a few seconds.')); ?>
+ getRedirectMessage()); ?>
- getRedirectParams() as $name => $value) { ?>
-
-
+ getRedirectParams() as $name => $value) { ?>
+
+
diff --git a/app/design/frontend/default/default/template/bundle/email/order/items/creditmemo/default.phtml b/app/design/frontend/default/default/template/bundle/email/order/items/creditmemo/default.phtml
index 6fad54dc25..4d3414ab03 100644
--- a/app/design/frontend/default/default/template/bundle/email/order/items/creditmemo/default.phtml
+++ b/app/design/frontend/default/default/template/bundle/email/order/items/creditmemo/default.phtml
@@ -67,8 +67,8 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Excl. Tax'); ?>:
typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
@@ -106,8 +106,8 @@
- helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/frontend/default/default/template/bundle/email/order/items/invoice/default.phtml b/app/design/frontend/default/default/template/bundle/email/order/items/invoice/default.phtml
index f531dacbda..90f6bece9d 100644
--- a/app/design/frontend/default/default/template/bundle/email/order/items/invoice/default.phtml
+++ b/app/design/frontend/default/default/template/bundle/email/order/items/invoice/default.phtml
@@ -68,8 +68,8 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Excl. Tax'); ?>:
typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
@@ -107,8 +107,8 @@
- helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/frontend/default/default/template/bundle/email/order/items/order/default.phtml b/app/design/frontend/default/default/template/bundle/email/order/items/order/default.phtml
index 52d6d515b6..1d692e6c1c 100644
--- a/app/design/frontend/default/default/template/bundle/email/order/items/order/default.phtml
+++ b/app/design/frontend/default/default/template/bundle/email/order/items/order/default.phtml
@@ -68,8 +68,8 @@
getParentItem()): ?>
- helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Excl. Tax'); ?>:
typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
@@ -107,8 +107,8 @@
- helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/frontend/default/default/template/bundle/sales/order/creditmemo/items/renderer.phtml b/app/design/frontend/default/default/template/bundle/sales/order/creditmemo/items/renderer.phtml
index 4baebcb375..0325bb749c 100644
--- a/app/design/frontend/default/default/template/bundle/sales/order/creditmemo/items/renderer.phtml
+++ b/app/design/frontend/default/default/template/bundle/sales/order/creditmemo/items/renderer.phtml
@@ -66,9 +66,9 @@
getSku() ?>
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -123,9 +123,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -193,9 +193,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -251,9 +251,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
diff --git a/app/design/frontend/default/default/template/bundle/sales/order/invoice/items/renderer.phtml b/app/design/frontend/default/default/template/bundle/sales/order/invoice/items/renderer.phtml
index 7e66d47c38..2adaa6b52c 100644
--- a/app/design/frontend/default/default/template/bundle/sales/order/invoice/items/renderer.phtml
+++ b/app/design/frontend/default/default/template/bundle/sales/order/invoice/items/renderer.phtml
@@ -63,9 +63,9 @@
getSku() ?>
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -120,9 +120,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -190,9 +190,9 @@
canShowPriceInfo($_item)): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -247,9 +247,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
diff --git a/app/design/frontend/default/default/template/bundle/sales/order/items/renderer.phtml b/app/design/frontend/default/default/template/bundle/sales/order/items/renderer.phtml
index f8cc2020cb..45fa622d80 100644
--- a/app/design/frontend/default/default/template/bundle/sales/order/items/renderer.phtml
+++ b/app/design/frontend/default/default/template/bundle/sales/order/items/renderer.phtml
@@ -62,9 +62,9 @@
splitInjection($_item->getSku()) ?>
getParentItem()): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -119,9 +119,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -205,9 +205,9 @@
getParentItem()): ?>
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceExclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceExclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -262,9 +262,9 @@
- helper('tax')->displayCartBothPrices() || $this->helper('tax')->displayCartPriceInclTax()): ?>
+ helper('tax')->displaySalesBothPrices() || $this->helper('tax')->displaySalesPriceInclTax()): ?>
- helper('tax')->displayCartBothPrices()): ?>
+ helper('tax')->displaySalesBothPrices()): ?>
typeOfDisplay($this->getItem(), array(1, 4), 'sales') && (float)$this->getItem()->getWeeeTaxAppliedAmount()): ?>
@@ -326,10 +326,10 @@
diff --git a/app/design/frontend/default/default/template/catalog/product/compare/list.phtml b/app/design/frontend/default/default/template/catalog/product/compare/list.phtml
index 31a6fdb3a5..15c3282651 100644
--- a/app/design/frontend/default/default/template/catalog/product/compare/list.phtml
+++ b/app/design/frontend/default/default/template/catalog/product/compare/list.phtml
@@ -23,6 +23,7 @@
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
+/* @var $this Mage_Catalog_Block_Product_Compare_List */
?>
__('Compare Products') ?>
@@ -36,11 +37,11 @@
- getItems() as $_item): ?>
-
+ getItems() as $_item): ?>
+
-
+
@@ -48,22 +49,22 @@
- getItems() as $_item): ?>
+ getItems() as $_item): ?>
-
-
+
+
getReviewsSummaryHtml($_item, 'short') ?>
getPriceHtml($_item, true) ?>
isSaleable()): ?>
- __('Add to Cart') ?>
+ __('Add to Cart') ?>
__('Out of stock') ?>
helper('wishlist')->isAllow()) : ?>
- __('Add to Wishlist') ?>
+ __('Add to Wishlist') ?>
@@ -85,6 +86,9 @@
case "small_image": ?>
getProductAttributeValue($_item, $_attribute),0,10);
+ break;
default: ?>
getProductAttributeValue($_item, $_attribute)) ?>
getPriceHtml($_item, true) ?>
isSaleable()): ?>
- __('Add to Cart') ?>
+ __('Add to Cart') ?>
__('Out of stock') ?>
helper('wishlist')->isAllow()) : ?>
- __('Add to Wishlist') ?>
+ __('Add to Wishlist') ?>
diff --git a/app/design/frontend/default/default/template/catalog/product/compare/sidebar.phtml b/app/design/frontend/default/default/template/catalog/product/compare/sidebar.phtml
index 564f131b0d..6f689d6b85 100644
--- a/app/design/frontend/default/default/template/catalog/product/compare/sidebar.phtml
+++ b/app/design/frontend/default/default/template/catalog/product/compare/sidebar.phtml
@@ -23,22 +23,23 @@
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
+/* @var $this Mage_Catalog_Block_Product_Compare_Sidebar */
?>
- helper('catalog/product_compare')->getItemCount()>0): ?>
+ helper('catalog/product_compare')->getItemCount()>0): ?>
__('Compare Products - %d Items', $this->helper('catalog/product_compare')->getItemCount()) ?>
__('Compare Products') ?>
- helper('catalog/product_compare')->getItemCount()>0): ?>
+ helper('catalog/product_compare')->getItemCount() > 0): ?>
helper('catalog/product_compare')->getItemCollection() as $_index=>$_item): ?>
- htmlEscape($_item->getName()) ?>
+ htmlEscape($_item->getName()) ?>
diff --git a/app/design/frontend/default/default/template/catalog/product/list.phtml b/app/design/frontend/default/default/template/catalog/product/list.phtml
index 6ba76af8fc..c813a25345 100644
--- a/app/design/frontend/default/default/template/catalog/product/list.phtml
+++ b/app/design/frontend/default/default/template/catalog/product/list.phtml
@@ -60,7 +60,7 @@
getPriceHtml($_product, true) ?>
isSaleable()): ?>
-
__('Add to Cart') ?>
+
__('Add to Cart') ?>
__('Out of stock') ?>
diff --git a/app/design/frontend/default/default/template/catalogsearch/form.mini.phtml b/app/design/frontend/default/default/template/catalogsearch/form.mini.phtml
index ca87617815..33a25a7f41 100644
--- a/app/design/frontend/default/default/template/catalogsearch/form.mini.phtml
+++ b/app/design/frontend/default/default/template/catalogsearch/form.mini.phtml
@@ -24,17 +24,17 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
-
+
__('Search Site') ?>
diff --git a/app/design/frontend/default/default/template/catalogsearch/result.phtml b/app/design/frontend/default/default/template/catalogsearch/result.phtml
index 97dbaed26e..2e600456b4 100644
--- a/app/design/frontend/default/default/template/catalogsearch/result.phtml
+++ b/app/design/frontend/default/default/template/catalogsearch/result.phtml
@@ -30,7 +30,7 @@
helper('rss/catalog')->getTagFeedUrl()): ?>
__('Subscribe to Feed') ?>
- getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogSearch')->getEscapedQueryText()) ?>
+ getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?>
getNoteMessages()):?>
@@ -42,7 +42,7 @@
getProductListHtml() ?>
-
getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogSearch')->getEscapedQueryText()) ?>
+ getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?>
getNoResultText()) ? $this->getNoResultText() : $this->__('Your search returns no results.') ?>
diff --git a/app/design/frontend/default/default/template/checkout/cart/item/default.phtml b/app/design/frontend/default/default/template/checkout/cart/item/default.phtml
index da6fc2de67..4fb5950da4 100644
--- a/app/design/frontend/default/default/template/checkout/cart/item/default.phtml
+++ b/app/design/frontend/default/default/template/checkout/cart/item/default.phtml
@@ -27,9 +27,15 @@
getItem()?>
-
+ hasProductUrl()):?>
+
+ hasProductUrl()):?>
-
+ hasProductUrl()):?>
+ getProductName() ?>
+
+ getProductName() ?>
+
getOptionList()):?>
diff --git a/app/design/frontend/default/default/template/checkout/onepage/billing.phtml b/app/design/frontend/default/default/template/checkout/onepage/billing.phtml
index f2686b241d..9d321b237a 100644
--- a/app/design/frontend/default/default/template/checkout/onepage/billing.phtml
+++ b/app/design/frontend/default/default/template/checkout/onepage/billing.phtml
@@ -135,6 +135,6 @@
//billingForm.setElementsRelation('billing:country_id', 'billing:region', 'getUrl('directory/json/childRegion') ?>', '__('Select State/Province...') ?>');
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
- var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions);
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, helper('directory')->getCountriesWithOptionalZipJson() ?>);
//]]>
diff --git a/app/design/frontend/default/default/template/checkout/onepage/login.phtml b/app/design/frontend/default/default/template/checkout/onepage/login.phtml
index a9da21b662..4c7c4dad6b 100644
--- a/app/design/frontend/default/default/template/checkout/onepage/login.phtml
+++ b/app/design/frontend/default/default/template/checkout/onepage/login.phtml
@@ -64,7 +64,7 @@
__('Login') ?>
getMessagesBlock()->getGroupedHtml() ?>
-
+
__('Already registered?') ?>
__('Please log in below:') ?>
diff --git a/app/design/frontend/default/default/template/customer/form/address.phtml b/app/design/frontend/default/default/template/customer/form/address.phtml
index 205a3fe5ad..e0159ee5e3 100644
--- a/app/design/frontend/default/default/template/customer/form/address.phtml
+++ b/app/design/frontend/default/default/template/customer/form/address.phtml
@@ -117,5 +117,5 @@
var dataForm = new VarienForm('form-validate', true);
//dataForm.setElementsRelation('country', 'state', 'getUrl('directory/json/childRegion') ?>');
- new RegionUpdater('country', 'region', 'region_id', countryRegions);
+ new RegionUpdater('country', 'region', 'region_id', countryRegions, undefined, helper('directory')->getCountriesWithOptionalZipJson() ?>);
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/customer/form/register.phtml b/app/design/frontend/default/default/template/customer/form/register.phtml
index 8621dae71a..2c50c240c8 100644
--- a/app/design/frontend/default/default/template/customer/form/register.phtml
+++ b/app/design/frontend/default/default/template/customer/form/register.phtml
@@ -146,7 +146,7 @@
//getShowAddressFields()): ?>
- new RegionUpdater('country', 'region', 'region_id', helper('directory')->getRegionJson() ?>);
+ new RegionUpdater('country', 'region', 'region_id', helper('directory')->getRegionJson() ?>, undefined, helper('directory')->getCountriesWithOptionalZipJson() ?>);
//]]>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/cybermut/error.phtml b/app/design/frontend/default/default/template/cybermut/error.phtml
new file mode 100644
index 0000000000..106b7a4ed8
--- /dev/null
+++ b/app/design/frontend/default/default/template/cybermut/error.phtml
@@ -0,0 +1,30 @@
+
+
+
__('Error occured') ?>
+
+
__('There was an error occurred during paying process.') ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/cybermut/form.phtml b/app/design/frontend/default/default/template/cybermut/form.phtml
new file mode 100644
index 0000000000..28c3984a30
--- /dev/null
+++ b/app/design/frontend/default/default/template/cybermut/form.phtml
@@ -0,0 +1,34 @@
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/cybersource/form.phtml b/app/design/frontend/default/default/template/cybersource/form.phtml
new file mode 100644
index 0000000000..5399e03dd9
--- /dev/null
+++ b/app/design/frontend/default/default/template/cybersource/form.phtml
@@ -0,0 +1,183 @@
+
+
+ getMethodCode() ?>
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/cybersource/info.phtml b/app/design/frontend/default/default/template/cybersource/info.phtml
new file mode 100644
index 0000000000..09c61b10ff
--- /dev/null
+++ b/app/design/frontend/default/default/template/cybersource/info.phtml
@@ -0,0 +1,39 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+
+__('Credit Card Type: %s', $this->getCcTypeName()) ?>
+__('Credit Card Number: xxxx-%s', $this->getInfo()->getCcLast4()) ?>
+__('Expiration Date: %s/%s', $this->getCcExpMonth(), $this->getInfo()->getCcExpYear()) ?>
+getInfo()->getCcSsIssue()): ?>
+__("Switch/Solo/Maestro(UK Domestic) card issue number: %s", $this->getInfo()->getCcSsIssue()) ?>
+
+getInfo()->getCcSsStartYear()): ?>
+__('Switch/Solo/Maestro(UK Domestic) card start Date: %s/%s', $this->getCcStartMonth(), $this->getInfo()->getCcSsStartYear()) ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/email/order/creditmemo/items.phtml b/app/design/frontend/default/default/template/email/order/creditmemo/items.phtml
index 571686ea23..f27db5136b 100644
--- a/app/design/frontend/default/default/template/email/order/creditmemo/items.phtml
+++ b/app/design/frontend/default/default/template/email/order/creditmemo/items.phtml
@@ -45,45 +45,7 @@
-
- __('Subtotal') ?>
- formatPrice($_creditmemo->getSubtotal()) ?>
-
- getDiscountAmount() > 0): ?>
-
- __('Discount%s', $_order->getCouponCode() ? ' ('.$_order->getCouponCode().')' : '') ?>
- formatPrice(0.00 - $_creditmemo->getDiscountAmount()) ?>
-
-
- getShippingAmount()): ?>
-
- __('Shipping & Handling') ?>
- formatPrice($_creditmemo->getShippingAmount()) ?>
-
-
- getTaxAmount() > 0)||(Mage::helper('tax')->displayZeroTax())): ?>
-
- __('Tax') ?>
- formatPrice($_creditmemo->getTaxAmount()) ?>
-
-
- getAdjustmentPositive()): ?>
-
- __('Adjustment Refund') ?>
- formatPrice($_creditmemo->getAdjustmentPositive()) ?>
-
-
-
- getAdjustmentNegative()): ?>
-
- __('Adjustment Fee') ?>
- formatPrice($_creditmemo->getAdjustmentNegative()) ?>
-
-
-
- __('Grand Total') ?>
- formatPrice($_creditmemo->getGrandTotal()) ?>
-
+ getChildHtml('creditmemo_totals');?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/email/order/invoice/items.phtml b/app/design/frontend/default/default/template/email/order/invoice/items.phtml
index 5cbc0ea033..c4f0550060 100644
--- a/app/design/frontend/default/default/template/email/order/invoice/items.phtml
+++ b/app/design/frontend/default/default/template/email/order/invoice/items.phtml
@@ -45,32 +45,7 @@
-
- __('Subtotal') ?>
- formatPrice($_invoice->getSubtotal()) ?>
-
- getDiscountAmount() > 0): ?>
-
- __('Discount%s', $_order->getCouponCode() ? ' ('.$_order->getCouponCode().')' : '') ?>
- formatPrice(0.00 - $_invoice->getDiscountAmount()) ?>
-
-
- getShippingAmount()): ?>
-
- __('Shipping & Handling') ?>
- formatPrice($_invoice->getShippingAmount()) ?>
-
-
- getTaxAmount() > 0)||(Mage::helper('tax')->displayZeroTax())): ?>
-
- __('Tax') ?>
- formatPrice($_invoice->getTaxAmount()) ?>
-
-
-
- __('Grand Total') ?>
- formatPrice($_invoice->getGrandTotal()) ?>
-
+ getChildHtml('invoice_totals')?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/email/order/items.phtml b/app/design/frontend/default/default/template/email/order/items.phtml
index bc8d188102..90e49848ed 100644
--- a/app/design/frontend/default/default/template/email/order/items.phtml
+++ b/app/design/frontend/default/default/template/email/order/items.phtml
@@ -53,32 +53,6 @@
-
- __('Subtotal') ?>
- formatPrice($_order->getSubtotal()) ?>
-
- getDiscountAmount() > 0): ?>
-
- __('Discount '.($_order->getCouponCode()?'('.$_order->getCouponCode().')':'')) ?>
- formatPrice(0.00 - $_order->getDiscountAmount()) ?>
-
-
- getShippingAmount() || $_order->getShippingDescription()): ?>
-
- __('Shipping & Handling') ?>
- formatPrice($_order->getShippingAmount()) ?>
-
-
- getTaxAmount() > 0)||(Mage::helper('tax')->displayZeroTax())): ?>
-
- __('Tax') ?>
- formatPrice($_order->getTaxAmount()) ?>
-
-
-
- __('Grand Total') ?>
- formatPrice($_order->getGrandTotal()) ?>
-
+ getChildHtml('order_totals') ?>
-
diff --git a/app/design/frontend/default/default/template/email/order/items/creditmemo/default.phtml b/app/design/frontend/default/default/template/email/order/items/creditmemo/default.phtml
index 8f83ffe28e..59d456c940 100644
--- a/app/design/frontend/default/default/template/email/order/items/creditmemo/default.phtml
+++ b/app/design/frontend/default/default/template/email/order/items/creditmemo/default.phtml
@@ -42,8 +42,8 @@
getSku($_item) ?>
getQty()*1 ?>
- helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Excl. Tax'); ?>:
typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
@@ -81,8 +81,8 @@
- helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/frontend/default/default/template/email/order/items/invoice/default.phtml b/app/design/frontend/default/default/template/email/order/items/invoice/default.phtml
index 8f83ffe28e..59d456c940 100644
--- a/app/design/frontend/default/default/template/email/order/items/invoice/default.phtml
+++ b/app/design/frontend/default/default/template/email/order/items/invoice/default.phtml
@@ -42,8 +42,8 @@
getSku($_item) ?>
getQty()*1 ?>
- helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Excl. Tax'); ?>:
typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
@@ -81,8 +81,8 @@
- helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/frontend/default/default/template/email/order/items/order/default.phtml b/app/design/frontend/default/default/template/email/order/items/order/default.phtml
index aca35c2d02..9725721335 100644
--- a/app/design/frontend/default/default/template/email/order/items/order/default.phtml
+++ b/app/design/frontend/default/default/template/email/order/items/order/default.phtml
@@ -48,8 +48,8 @@
getSku($_item) ?>
getQtyOrdered()*1 ?>
- helper('tax')->displayCartPriceExclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceExclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Excl. Tax'); ?>:
typeOfDisplay($_item, array(0, 1, 4), 'email', $_order->getStore())): ?>
@@ -87,8 +87,8 @@
- helper('tax')->displayCartPriceInclTax($_order->getStore()) || $this->helper('tax')->displayCartBothPrices($_order->getStore())): ?>
- helper('tax')->displayCartBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesPriceInclTax($_order->getStore()) || $this->helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
+ helper('tax')->displaySalesBothPrices($_order->getStore())): ?>
__('Incl. Tax'); ?>:
helper('checkout')->getSubtotalInclTax($_item); ?>
diff --git a/app/design/frontend/default/default/template/eway/form.phtml b/app/design/frontend/default/default/template/eway/form.phtml
new file mode 100644
index 0000000000..b09c35085f
--- /dev/null
+++ b/app/design/frontend/default/default/template/eway/form.phtml
@@ -0,0 +1,92 @@
+
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/eway/info.phtml b/app/design/frontend/default/default/template/eway/info.phtml
new file mode 100644
index 0000000000..045d64a8a5
--- /dev/null
+++ b/app/design/frontend/default/default/template/eway/info.phtml
@@ -0,0 +1,34 @@
+
+getInfo()): ?>
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/eway/secure/failure.phtml b/app/design/frontend/default/default/template/eway/secure/failure.phtml
new file mode 100644
index 0000000000..c67f634925
--- /dev/null
+++ b/app/design/frontend/default/default/template/eway/secure/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>.
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/eway/secure/form.phtml b/app/design/frontend/default/default/template/eway/secure/form.phtml
new file mode 100644
index 0000000000..4e4b575b48
--- /dev/null
+++ b/app/design/frontend/default/default/template/eway/secure/form.phtml
@@ -0,0 +1,34 @@
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/eway/shared/failure.phtml b/app/design/frontend/default/default/template/eway/shared/failure.phtml
new file mode 100644
index 0000000000..c67f634925
--- /dev/null
+++ b/app/design/frontend/default/default/template/eway/shared/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>.
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/eway/shared/form.phtml b/app/design/frontend/default/default/template/eway/shared/form.phtml
new file mode 100644
index 0000000000..7af42664c9
--- /dev/null
+++ b/app/design/frontend/default/default/template/eway/shared/form.phtml
@@ -0,0 +1,34 @@
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/flo2cash/form.phtml b/app/design/frontend/default/default/template/flo2cash/form.phtml
new file mode 100644
index 0000000000..6356f2ee27
--- /dev/null
+++ b/app/design/frontend/default/default/template/flo2cash/form.phtml
@@ -0,0 +1,89 @@
+
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/flo2cash/info.phtml b/app/design/frontend/default/default/template/flo2cash/info.phtml
new file mode 100644
index 0000000000..b6c27bfca7
--- /dev/null
+++ b/app/design/frontend/default/default/template/flo2cash/info.phtml
@@ -0,0 +1,35 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/ideal/advanced/failure.phtml b/app/design/frontend/default/default/template/ideal/advanced/failure.phtml
new file mode 100644
index 0000000000..37028aa2f9
--- /dev/null
+++ b/app/design/frontend/default/default/template/ideal/advanced/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/ideal/advanced/form.phtml b/app/design/frontend/default/default/template/ideal/advanced/form.phtml
new file mode 100755
index 0000000000..0aaba774f7
--- /dev/null
+++ b/app/design/frontend/default/default/template/ideal/advanced/form.phtml
@@ -0,0 +1,44 @@
+
+getMethodCode() ?>
+getIssuerList()):?>
+
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/ideal/advanced/info.phtml b/app/design/frontend/default/default/template/ideal/advanced/info.phtml
new file mode 100644
index 0000000000..77c2c48303
--- /dev/null
+++ b/app/design/frontend/default/default/template/ideal/advanced/info.phtml
@@ -0,0 +1,33 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+
+__('Issuer'). ': ' . $this->getIssuerTitle() ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/ideal/basic/failure.phtml b/app/design/frontend/default/default/template/ideal/basic/failure.phtml
new file mode 100644
index 0000000000..37028aa2f9
--- /dev/null
+++ b/app/design/frontend/default/default/template/ideal/basic/failure.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/ideal/basic/form.phtml b/app/design/frontend/default/default/template/ideal/basic/form.phtml
new file mode 100755
index 0000000000..c1508a57c4
--- /dev/null
+++ b/app/design/frontend/default/default/template/ideal/basic/form.phtml
@@ -0,0 +1,34 @@
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/oscommerce/order/list.phtml b/app/design/frontend/default/default/template/oscommerce/order/list.phtml
new file mode 100644
index 0000000000..6a420f4a30
--- /dev/null
+++ b/app/design/frontend/default/default/template/oscommerce/order/list.phtml
@@ -0,0 +1,56 @@
+
+getOsCommerceOrders(); ?>
+
+
+
__('My Previous Orders') ?>
+
+
+
+
+ __('Order #') ?>
+ __('Date') ?>
+ __('Ship to') ?>
+ __('Order Total') ?>
+
+
+
+
+
+
+
+
+ formatDate($_oscOrder['date_purchased'], 'medium', true) ?>
+ htmlEscape($_oscOrder['delivery_street_address']) ?>
+
+ __('View Order') ?>
+
+
+
+
+
+
diff --git a/app/design/frontend/default/default/template/oscommerce/order/view.phtml b/app/design/frontend/default/default/template/oscommerce/order/view.phtml
new file mode 100644
index 0000000000..a8d3b985e1
--- /dev/null
+++ b/app/design/frontend/default/default/template/oscommerce/order/view.phtml
@@ -0,0 +1,139 @@
+
+getOrder() ?>
+
+
+
+
+
__('Order') ?> #
+
+__('Order Date:')?> formatDate($_order['date_purchased'], 'medium', false) ?>
+
+
+
+
__('Shipping Address') ?>
+
+
+
+
+
+
+T:
+
+
+
+
+
+
+
__('Shipping Method') ?>
+
+
+
+
+
+
+
+
+
__('Billing Address') ?>
+
+
+
+
+
+
+T:
+
+
+
+
+
Payment Method
+
+
+
+
+__('Items Ordered') ?>
+
+
+
+
+ __('Product Name') ?>
+ __('SKU') ?>
+ __('Price') ?>
+ __('Qty Ordered') ?>
+ __('Subtotal') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ __('About Your Order') ?>
+
+
+
+ formatDate($_historyItem['date_added'], 'medium', true) ?> |
+
+
+
+
+
+
+
diff --git a/app/design/frontend/default/default/template/paybox/direct/form.phtml b/app/design/frontend/default/default/template/paybox/direct/form.phtml
new file mode 100644
index 0000000000..b867c5533a
--- /dev/null
+++ b/app/design/frontend/default/default/template/paybox/direct/form.phtml
@@ -0,0 +1,90 @@
+
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/paybox/direct/info.phtml b/app/design/frontend/default/default/template/paybox/direct/info.phtml
new file mode 100644
index 0000000000..1f257d6c67
--- /dev/null
+++ b/app/design/frontend/default/default/template/paybox/direct/info.phtml
@@ -0,0 +1,35 @@
+
+getInfo()): ?>
+getMethod()->getTitle() ?>
+__('Name on the Card: %s', $this->htmlEscape($this->getInfo()->getCcOwner())) ?>
+__('Credit Card Type: %s', $this->htmlEscape($this->getCcTypeName())) ?>
+__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
+__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>
+
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/paybox/system/error.phtml b/app/design/frontend/default/default/template/paybox/system/error.phtml
new file mode 100644
index 0000000000..aea6e53996
--- /dev/null
+++ b/app/design/frontend/default/default/template/paybox/system/error.phtml
@@ -0,0 +1,31 @@
+
+
+
__('Error occured') ?>
+
+getErrorMessage() ?>.
+__('Please continue shopping .', $this->getContinueShoppingUrl()) ?>
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/paybox/system/form.phtml b/app/design/frontend/default/default/template/paybox/system/form.phtml
new file mode 100644
index 0000000000..b4107d84a5
--- /dev/null
+++ b/app/design/frontend/default/default/template/paybox/system/form.phtml
@@ -0,0 +1,34 @@
+
+
+ getMethodCode() ?>
+
+
\ No newline at end of file
diff --git a/app/design/frontend/default/default/template/payment/form/cc.phtml b/app/design/frontend/default/default/template/payment/form/cc.phtml
index 0eaedb7a72..18b4497768 100644
--- a/app/design/frontend/default/default/template/payment/form/cc.phtml
+++ b/app/design/frontend/default/default/template/payment/form/cc.phtml
@@ -72,6 +72,7 @@
+ getChildHtml() ?>
hasVerification()): ?>