Version Notes
This extension can be used by the users of bluefishretail,by providing appropriate credentials,given to them by bluefishretail.
Download this release
Release Info
| Developer | J Doyle |
| Extension | Bluefish_Connection |
| Version | 1.1.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.3 to 1.1.4
- app/code/local/Bluefish/Connection/Block/Adminhtml/Bluestorescheduler/Grid.php +17 -3
- app/code/local/Bluefish/Connection/Block/Adminhtml/Errorsaleimport/Grid.php +5 -9
- app/code/local/Bluefish/Connection/Block/Bluestoreproducttype.php +88 -0
- app/code/local/Bluefish/Connection/Block/Databasemapping.php +12 -16
- app/code/local/Bluefish/Connection/Block/Outofstocksale.php +74 -0
- app/code/local/Bluefish/Connection/Block/Productdatabasemapping.php +14 -18
- app/code/local/Bluefish/Connection/Block/Salesmapping.php +74 -0
- app/code/local/Bluefish/Connection/Model/Carrier/Bsaleshippingmethod.php +4 -9
- app/code/local/Bluefish/Connection/Model/CatalogInventory/Stock/Item.php +151 -0
- app/code/local/Bluefish/Connection/Model/Checkout/Cart/Api.php +75 -0
- app/code/local/Bluefish/Connection/Model/Cronobserver.php +111 -0
- app/code/local/Bluefish/Connection/Model/Observer.php +267 -98
- app/code/local/Bluefish/Connection/Model/Validationcrontime.php +113 -98
- app/code/local/Bluefish/Connection/controllers/Adminhtml/MyformController.php +530 -121
- app/code/local/Bluefish/Connection/controllers/Adminhtml/MyformexportController.php +313 -47
- app/code/local/Bluefish/Connection/controllers/Adminhtml/Xml.php +1265 -809
- app/code/local/Bluefish/Connection/etc/config.xml +75 -35
- app/code/local/Bluefish/Connection/etc/system.xml +183 -77
- app/design/adminhtml/default/default/template/connection/array_dropdown.phtml +25 -10
- app/design/adminhtml/default/default/template/connection/cronschedule.phtml +7 -12
- app/design/adminhtml/default/default/template/connection/custom_product_radioinput.phtml +0 -11
- app/design/adminhtml/default/default/template/connection/custom_radioinput.phtml +1 -13
- app/design/adminhtml/default/default/template/connection/myformexport.phtml +8 -4
- app/design/adminhtml/default/default/template/connection/outofstocksale.phtml +60 -0
- app/design/adminhtml/default/default/template/connection/salesmapping_radioinput.phtml +60 -0
- app/etc/modules/Bluefish_Connection.xml +1 -1
- package.xml +13 -12
app/code/local/Bluefish/Connection/Block/Adminhtml/Bluestorescheduler/Grid.php
CHANGED
|
@@ -24,7 +24,21 @@ class Bluefish_Connection_Block_Adminhtml_Bluestorescheduler_Grid extends Mage_A
|
|
| 24 |
*/
|
| 25 |
protected function _prepareCollection() {
|
| 26 |
$collection = Mage::getModel('cron/schedule')->getCollection();
|
| 27 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
$this->setCollection($collection);
|
| 29 |
return parent::_prepareCollection();
|
| 30 |
}
|
|
@@ -105,9 +119,9 @@ class Bluefish_Connection_Block_Adminhtml_Bluestorescheduler_Grid extends Mage_A
|
|
| 105 |
|
| 106 |
public function decorateMessages($value, $row) {
|
| 107 |
$return = '';
|
| 108 |
-
$connection
|
| 109 |
$prefix = Mage::getConfig()->getTablePrefix();
|
| 110 |
-
$scheduleLog
|
| 111 |
$scheduleResult = $scheduleLog->fetchAll(PDO::FETCH_ASSOC);
|
| 112 |
$errorLogsNum = count($scheduleResult);
|
| 113 |
|
| 24 |
*/
|
| 25 |
protected function _prepareCollection() {
|
| 26 |
$collection = Mage::getModel('cron/schedule')->getCollection();
|
| 27 |
+
$disabedCrons = split(",",Mage::getStoreConfig('system/cron/disabled_crons'));
|
| 28 |
+
|
| 29 |
+
$jobcodeArray = array();
|
| 30 |
+
$jobcodeArray[] = "bluefish_connection_category";
|
| 31 |
+
$jobcodeArray[] = "bluefish_connection_customer";
|
| 32 |
+
$jobcodeArray[] = "bluefish_connection_customerexport";
|
| 33 |
+
$jobcodeArray[] = "bluefish_connection_orderexport";
|
| 34 |
+
$jobcodeArray[] = "bluefish_connection_orderimport";
|
| 35 |
+
$jobcodeArray[] = "bluefish_connection_product";
|
| 36 |
+
$jobcodeArray[] = "bluefish_connection_productexport";
|
| 37 |
+
$jobcodeArray[] = "bluefish_connection_stock";
|
| 38 |
+
|
| 39 |
+
$resultArray = array_diff($jobcodeArray, $disabedCrons);
|
| 40 |
+
|
| 41 |
+
$collection->addFieldToFilter('job_code',array('in'=>$resultArray));
|
| 42 |
$this->setCollection($collection);
|
| 43 |
return parent::_prepareCollection();
|
| 44 |
}
|
| 119 |
|
| 120 |
public function decorateMessages($value, $row) {
|
| 121 |
$return = '';
|
| 122 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 123 |
$prefix = Mage::getConfig()->getTablePrefix();
|
| 124 |
+
$scheduleLog = $connection->query("SELECT error FROM ".$prefix."bluefish_cron_schedule_logs WHERE schedule_id = '".$row->getScheduleId()."'");
|
| 125 |
$scheduleResult = $scheduleLog->fetchAll(PDO::FETCH_ASSOC);
|
| 126 |
$errorLogsNum = count($scheduleResult);
|
| 127 |
|
app/code/local/Bluefish/Connection/Block/Adminhtml/Errorsaleimport/Grid.php
CHANGED
|
@@ -2,7 +2,6 @@
|
|
| 2 |
|
| 3 |
class Bluefish_Connection_Block_Adminhtml_Errorsaleimport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 4 |
{
|
| 5 |
-
|
| 6 |
public function __construct()
|
| 7 |
{
|
| 8 |
parent::__construct();
|
|
@@ -11,7 +10,7 @@ class Bluefish_Connection_Block_Adminhtml_Errorsaleimport_Grid extends Mage_Admi
|
|
| 11 |
$this->setDefaultDir("DESC");
|
| 12 |
$this->setSaveParametersInSession(true);
|
| 13 |
}
|
| 14 |
-
|
| 15 |
protected function _prepareCollection()
|
| 16 |
{
|
| 17 |
$collection = Mage::getModel("connection/errorsaleimport")->getCollection();
|
|
@@ -24,10 +23,10 @@ class Bluefish_Connection_Block_Adminhtml_Errorsaleimport_Grid extends Mage_Admi
|
|
| 24 |
"header" => Mage::helper("connection")->__("ID"),
|
| 25 |
"align" =>"right",
|
| 26 |
"width" => "50px",
|
| 27 |
-
|
| 28 |
"index" => "id",
|
| 29 |
));
|
| 30 |
-
|
| 31 |
$this->addColumn("sale_code", array(
|
| 32 |
"header" => Mage::helper("connection")->__("Transaction Code"),
|
| 33 |
"index" => "sale_code",
|
|
@@ -48,16 +47,13 @@ class Bluefish_Connection_Block_Adminhtml_Errorsaleimport_Grid extends Mage_Admi
|
|
| 48 |
));
|
| 49 |
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
| 50 |
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
|
| 51 |
-
|
| 52 |
return parent::_prepareColumns();
|
| 53 |
}
|
| 54 |
-
|
| 55 |
public function getRowUrl($row)
|
| 56 |
{
|
| 57 |
return '#';
|
| 58 |
}
|
| 59 |
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
}
|
| 2 |
|
| 3 |
class Bluefish_Connection_Block_Adminhtml_Errorsaleimport_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
| 4 |
{
|
|
|
|
| 5 |
public function __construct()
|
| 6 |
{
|
| 7 |
parent::__construct();
|
| 10 |
$this->setDefaultDir("DESC");
|
| 11 |
$this->setSaveParametersInSession(true);
|
| 12 |
}
|
| 13 |
+
|
| 14 |
protected function _prepareCollection()
|
| 15 |
{
|
| 16 |
$collection = Mage::getModel("connection/errorsaleimport")->getCollection();
|
| 23 |
"header" => Mage::helper("connection")->__("ID"),
|
| 24 |
"align" =>"right",
|
| 25 |
"width" => "50px",
|
| 26 |
+
"type" => "number",
|
| 27 |
"index" => "id",
|
| 28 |
));
|
| 29 |
+
|
| 30 |
$this->addColumn("sale_code", array(
|
| 31 |
"header" => Mage::helper("connection")->__("Transaction Code"),
|
| 32 |
"index" => "sale_code",
|
| 47 |
));
|
| 48 |
$this->addExportType('*/*/exportCsv', Mage::helper('sales')->__('CSV'));
|
| 49 |
$this->addExportType('*/*/exportExcel', Mage::helper('sales')->__('Excel'));
|
| 50 |
+
|
| 51 |
return parent::_prepareColumns();
|
| 52 |
}
|
| 53 |
+
|
| 54 |
public function getRowUrl($row)
|
| 55 |
{
|
| 56 |
return '#';
|
| 57 |
}
|
| 58 |
|
|
|
|
|
|
|
|
|
|
| 59 |
}
|
app/code/local/Bluefish/Connection/Block/Bluestoreproducttype.php
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Adminhtml system config array field renderer
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
class Bluefish_Connection_Block_Bluestoreproducttype extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
| 35 |
+
{
|
| 36 |
+
protected $magentoAttributes;
|
| 37 |
+
|
| 38 |
+
public function __construct()
|
| 39 |
+
{
|
| 40 |
+
$this->addColumn('magentoproducttype', array(
|
| 41 |
+
'label' => Mage::helper('adminhtml')->__('Magento Product Type'),
|
| 42 |
+
'size' => 28,
|
| 43 |
+
));
|
| 44 |
+
$this->addColumn('bluestoreproducttype', array(
|
| 45 |
+
'label' => Mage::helper('adminhtml')->__('Bluestore Product Type'),
|
| 46 |
+
'size' => 28
|
| 47 |
+
));
|
| 48 |
+
$this->_addAfter = false;
|
| 49 |
+
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add New Product Type');
|
| 50 |
+
|
| 51 |
+
parent::__construct();
|
| 52 |
+
$this->setTemplate('connection/array_dropdown.phtml');
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
protected function _renderCellTemplate($columnName)
|
| 56 |
+
{
|
| 57 |
+
if (empty($this->_columns[$columnName])) {
|
| 58 |
+
throw new Exception('Wrong column name specified.');
|
| 59 |
+
}
|
| 60 |
+
$column = $this->_columns[$columnName];
|
| 61 |
+
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
| 62 |
+
|
| 63 |
+
if($columnName == 'magentoproducttype')
|
| 64 |
+
{
|
| 65 |
+
$productType = array("simple" => "Simple Product",
|
| 66 |
+
"grouped" => "Grouped Product",
|
| 67 |
+
"configurable" => "Configurable Product",
|
| 68 |
+
"virtual" => "Virtual Product",
|
| 69 |
+
"bundle" => "Bundle Product",
|
| 70 |
+
"downloadable" => "Downloadable Product"
|
| 71 |
+
);
|
| 72 |
+
|
| 73 |
+
$rendered = '<select name="'.$inputName.'">';
|
| 74 |
+
|
| 75 |
+
foreach($productType as $key => $value)
|
| 76 |
+
{
|
| 77 |
+
$rendered .= '<option value="'.$key.'">'.$value.'</option>';
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
$rendered .= '</select>';
|
| 81 |
+
}
|
| 82 |
+
else
|
| 83 |
+
{
|
| 84 |
+
$rendered = '<input type="text" name="'.$inputName.'" value="">';
|
| 85 |
+
}
|
| 86 |
+
return $rendered;
|
| 87 |
+
}
|
| 88 |
+
}
|
app/code/local/Bluefish/Connection/Block/Databasemapping.php
CHANGED
|
@@ -38,7 +38,7 @@ class Bluefish_Connection_Block_Databasemapping extends Mage_Adminhtml_Block_Sys
|
|
| 38 |
public function __construct()
|
| 39 |
{
|
| 40 |
$this->addColumn('Dbmapping', array(
|
| 41 |
-
'label' => Mage::helper('adminhtml')->__('
|
| 42 |
'size' => 28,
|
| 43 |
));
|
| 44 |
|
|
@@ -48,23 +48,19 @@ class Bluefish_Connection_Block_Databasemapping extends Mage_Adminhtml_Block_Sys
|
|
| 48 |
|
| 49 |
protected function _renderCellTemplate($columnName)
|
| 50 |
{
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
$numberRows = count($resultCronPath);
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
else
|
| 65 |
-
$checkbox_Direct = 'checked';
|
| 66 |
|
| 67 |
-
|
| 68 |
if (empty($this->_columns[$columnName])) {
|
| 69 |
throw new Exception('Wrong column name specified.');
|
| 70 |
}
|
| 38 |
public function __construct()
|
| 39 |
{
|
| 40 |
$this->addColumn('Dbmapping', array(
|
| 41 |
+
'label' => Mage::helper('adminhtml')->__(' '),
|
| 42 |
'size' => 28,
|
| 43 |
));
|
| 44 |
|
| 48 |
|
| 49 |
protected function _renderCellTemplate($columnName)
|
| 50 |
{
|
| 51 |
+
$credentialsCategory = Mage::getStoreConfig('mycustom_section/mycustom_category_group');
|
| 52 |
+
$categorymappingFlag = $credentialsCategory['mycustom_category_mapping_direct'];
|
| 53 |
+
$unserielVal = unserialize($categorymappingFlag);
|
| 54 |
+
$numberRows = count($unserielVal);
|
|
|
|
| 55 |
|
| 56 |
+
if($numberRows > 0)
|
| 57 |
+
{
|
| 58 |
+
$checkbox_Direct = ($unserielVal['#{_id}']['Dbmapping'] == 'Direct')?'checked':'unchecked';
|
| 59 |
+
$checkbox_Mapping = ($unserielVal['#{_id}']['Dbmapping'] == 'Mapping')?'checked':'unchecked';
|
| 60 |
+
}
|
| 61 |
+
else
|
| 62 |
+
$checkbox_Direct = 'checked';
|
|
|
|
|
|
|
| 63 |
|
|
|
|
| 64 |
if (empty($this->_columns[$columnName])) {
|
| 65 |
throw new Exception('Wrong column name specified.');
|
| 66 |
}
|
app/code/local/Bluefish/Connection/Block/Outofstocksale.php
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Adminhtml system config array field renderer
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
class Bluefish_Connection_Block_Outofstocksale extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
| 35 |
+
{
|
| 36 |
+
protected $magentoAttributes;
|
| 37 |
+
|
| 38 |
+
public function __construct()
|
| 39 |
+
{
|
| 40 |
+
$this->addColumn('Stockmapping', array(
|
| 41 |
+
'label' => Mage::helper('adminhtml')->__(' '),
|
| 42 |
+
'size' => 28,
|
| 43 |
+
));
|
| 44 |
+
|
| 45 |
+
parent::__construct();
|
| 46 |
+
$this->setTemplate('connection/outofstocksale.phtml');
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
protected function _renderCellTemplate($columnName)
|
| 50 |
+
{
|
| 51 |
+
$credentialsSales = Mage::getStoreConfig('mycustom_section/mycustom_sales_import_group');
|
| 52 |
+
$outofstockFlag = $credentialsSales['mycustom_outofstock_mapping'];
|
| 53 |
+
$unserielVal = unserialize($outofstockFlag);
|
| 54 |
+
$numberRows = count($unserielVal);
|
| 55 |
+
|
| 56 |
+
if($numberRows > 0)
|
| 57 |
+
{
|
| 58 |
+
$checkbox_Direct = ($unserielVal['#{_id}']['Stockmapping'] == 'Yes')?'checked':'unchecked';
|
| 59 |
+
$checkbox_Mapping = ($unserielVal['#{_id}']['Stockmapping'] == 'No')?'checked':'unchecked';
|
| 60 |
+
}
|
| 61 |
+
else
|
| 62 |
+
$checkbox_Mapping = 'checked';
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
if (empty($this->_columns[$columnName])) {
|
| 66 |
+
throw new Exception('Wrong column name specified.');
|
| 67 |
+
}
|
| 68 |
+
$column = $this->_columns[$columnName];
|
| 69 |
+
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
| 70 |
+
|
| 71 |
+
$rendered = 'Yes <input type="radio" name="'.$inputName.'" value="Yes" '.$checkbox_Direct.'> No <input type="radio" name="'.$inputName.'" value="No" '.$checkbox_Mapping.'>';
|
| 72 |
+
return $rendered;
|
| 73 |
+
}
|
| 74 |
+
}
|
app/code/local/Bluefish/Connection/Block/Productdatabasemapping.php
CHANGED
|
@@ -38,7 +38,7 @@ class Bluefish_Connection_Block_Productdatabasemapping extends Mage_Adminhtml_Bl
|
|
| 38 |
public function __construct()
|
| 39 |
{
|
| 40 |
$this->addColumn('Dbproductmapping', array(
|
| 41 |
-
'label' => Mage::helper('adminhtml')->__('
|
| 42 |
'size' => 28,
|
| 43 |
));
|
| 44 |
|
|
@@ -48,22 +48,18 @@ class Bluefish_Connection_Block_Productdatabasemapping extends Mage_Adminhtml_Bl
|
|
| 48 |
|
| 49 |
protected function _renderCellTemplate($columnName)
|
| 50 |
{
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
$
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
$checkbox_Direct = ($unserielVal['#{_id}']['Dbproductmapping'] == 'DirectProduct')?'checked':'unchecked';
|
| 63 |
-
$checkbox_Mapping = ($unserielVal['#{_id}']['Dbproductmapping'] == 'MappingProduct')?'checked':'unchecked';
|
| 64 |
-
}
|
| 65 |
-
else
|
| 66 |
-
$checkbox_Direct = 'checked';
|
| 67 |
|
| 68 |
|
| 69 |
if (empty($this->_columns[$columnName])) {
|
|
@@ -72,7 +68,7 @@ class Bluefish_Connection_Block_Productdatabasemapping extends Mage_Adminhtml_Bl
|
|
| 72 |
$column = $this->_columns[$columnName];
|
| 73 |
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
}
|
| 78 |
}
|
| 38 |
public function __construct()
|
| 39 |
{
|
| 40 |
$this->addColumn('Dbproductmapping', array(
|
| 41 |
+
'label' => Mage::helper('adminhtml')->__(' '),
|
| 42 |
'size' => 28,
|
| 43 |
));
|
| 44 |
|
| 48 |
|
| 49 |
protected function _renderCellTemplate($columnName)
|
| 50 |
{
|
| 51 |
+
$credentialsProduct = Mage::getStoreConfig('mycustom_section/mycustom_product_group');
|
| 52 |
+
$productmappingFlag = $credentialsProduct['mycustom_product_mapping_direct'];
|
| 53 |
+
$unserielVal = unserialize($productmappingFlag);
|
| 54 |
+
$numberRows = count($unserielVal);
|
| 55 |
|
| 56 |
+
if($numberRows > 0)
|
| 57 |
+
{
|
| 58 |
+
$checkbox_Direct = ($unserielVal['#{_id}']['Dbproductmapping'] == 'DirectProduct')?'checked':'unchecked';
|
| 59 |
+
$checkbox_Mapping = ($unserielVal['#{_id}']['Dbproductmapping'] == 'MappingProduct')?'checked':'unchecked';
|
| 60 |
+
}
|
| 61 |
+
else
|
| 62 |
+
$checkbox_Direct = 'checked';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
if (empty($this->_columns[$columnName])) {
|
| 68 |
$column = $this->_columns[$columnName];
|
| 69 |
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
| 70 |
|
| 71 |
+
$rendered = 'Direct Mapping <input type="radio" name="'.$inputName.'" value="DirectProduct" onclick="getdetails_related_product(\'DirectProduct\')" '.$checkbox_Direct.' id="DirectProduct"> Mapping Table <input type="radio" name="'.$inputName.'" value="MappingProduct" onclick="getdetails_related_product(\'MappingProduct\')" '.$checkbox_Mapping.' id="MappingProduct" >';
|
| 72 |
+
return $rendered;
|
| 73 |
}
|
| 74 |
}
|
app/code/local/Bluefish/Connection/Block/Salesmapping.php
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category Mage
|
| 22 |
+
* @package Mage_Adminhtml
|
| 23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Adminhtml system config array field renderer
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
class Bluefish_Connection_Block_Salesmapping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
|
| 35 |
+
{
|
| 36 |
+
protected $magentoAttributes;
|
| 37 |
+
|
| 38 |
+
public function __construct()
|
| 39 |
+
{
|
| 40 |
+
$this->addColumn('Salemapping', array(
|
| 41 |
+
'label' => Mage::helper('adminhtml')->__(' '),
|
| 42 |
+
'size' => 28,
|
| 43 |
+
));
|
| 44 |
+
|
| 45 |
+
parent::__construct();
|
| 46 |
+
$this->setTemplate('connection/salesmapping_radioinput.phtml');
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
protected function _renderCellTemplate($columnName)
|
| 50 |
+
{
|
| 51 |
+
$credentialsSales = Mage::getStoreConfig('mycustom_section/mycustom_sales_import_group');
|
| 52 |
+
$salemappingFlag = $credentialsSales['mycustom_sales_mapping_method'];
|
| 53 |
+
$unserielVal = unserialize($salemappingFlag);
|
| 54 |
+
$numberRows = count($unserielVal);
|
| 55 |
+
|
| 56 |
+
if($numberRows > 0)
|
| 57 |
+
{
|
| 58 |
+
$checkbox_Direct = ($unserielVal['#{_id}']['Salemapping'] == 'Productcode')?'checked':'unchecked';
|
| 59 |
+
$checkbox_Mapping = ($unserielVal['#{_id}']['Salemapping'] == 'Magentoid')?'checked':'unchecked';
|
| 60 |
+
}
|
| 61 |
+
else
|
| 62 |
+
$checkbox_Direct = 'checked';
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
if (empty($this->_columns[$columnName])) {
|
| 66 |
+
throw new Exception('Wrong column name specified.');
|
| 67 |
+
}
|
| 68 |
+
$column = $this->_columns[$columnName];
|
| 69 |
+
$inputName = $this->getElement()->getName() . '[#{_id}][' . $columnName . ']';
|
| 70 |
+
|
| 71 |
+
$rendered = 'SKU Mapping <input type="radio" name="'.$inputName.'" value="Productcode" '.$checkbox_Direct.' id="Productcode"> Product ID Mapping <input type="radio" name="'.$inputName.'" value="Magentoid" '.$checkbox_Mapping.' id="Magentoid" >';
|
| 72 |
+
return $rendered;
|
| 73 |
+
}
|
| 74 |
+
}
|
app/code/local/Bluefish/Connection/Model/Carrier/Bsaleshippingmethod.php
CHANGED
|
@@ -5,21 +5,16 @@ implements Mage_Shipping_Model_Carrier_Interface {
|
|
| 5 |
|
| 6 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
| 7 |
{
|
| 8 |
-
|
|
|
|
| 9 |
return false;
|
| 10 |
}
|
| 11 |
|
| 12 |
-
/*// Don't want to display on fronend
|
| 13 |
-
if(Mage::getDesign()->getArea() === Mage_Core_Model_App_Area::AREA_FRONTEND &&
|
| 14 |
-
!Mage::getStoreConfig('carriers/'.$this->_code.'/show_frontend')){
|
| 15 |
-
|
| 16 |
-
return false;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
// skip if not enabled
|
| 20 |
if(!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
|
| 21 |
return false;
|
| 22 |
-
}
|
|
|
|
| 23 |
|
| 24 |
$handling = Mage::getStoreConfig('carriers/'.$this->_code.'/handling');
|
| 25 |
$result = Mage::getModel('shipping/rate_result');
|
| 5 |
|
| 6 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
| 7 |
{
|
| 8 |
+
|
| 9 |
+
if((strpos($_SERVER['REQUEST_URI'] ,"/onestepcheckout/") !== false) || (strpos($_SERVER['REQUEST_URI'] ,"/checkout/cart/") !== false) || (strpos($_SERVER['PATH_INFO'] ,"/checkout/onepage/saveBilling/") !== false) || (strpos($_SERVER['PATH_INFO'] ,"/checkout/cart/") !== false)){
|
| 10 |
return false;
|
| 11 |
}
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
// skip if not enabled
|
| 14 |
if(!Mage::getStoreConfig('carriers/'.$this->_code.'/active')) {
|
| 15 |
return false;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
|
| 19 |
$handling = Mage::getStoreConfig('carriers/'.$this->_code.'/handling');
|
| 20 |
$result = Mage::getModel('shipping/rate_result');
|
app/code/local/Bluefish/Connection/Model/CatalogInventory/Stock/Item.php
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once 'Mage/CatalogInventory/Model/Stock/Item.php';
|
| 4 |
+
|
| 5 |
+
class Bluefish_Connection_Model_CatalogInventory_Stock_Item extends Mage_CatalogInventory_Model_Stock_Item
|
| 6 |
+
{
|
| 7 |
+
/**
|
| 8 |
+
* Checking quote item quantity
|
| 9 |
+
*
|
| 10 |
+
* Second parameter of this method specifies quantity of this product in whole shopping cart
|
| 11 |
+
* which should be checked for stock availability
|
| 12 |
+
*
|
| 13 |
+
* @param mixed $qty quantity of this item (item qty x parent item qty)
|
| 14 |
+
* @param mixed $summaryQty quantity of this product
|
| 15 |
+
* @param mixed $origQty original qty of item (not multiplied on parent item qty)
|
| 16 |
+
* @return Varien_Object
|
| 17 |
+
*/
|
| 18 |
+
public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0)
|
| 19 |
+
{
|
| 20 |
+
$result = new Varien_Object();
|
| 21 |
+
$result->setHasError(false);
|
| 22 |
+
|
| 23 |
+
if (!is_numeric($qty)) {
|
| 24 |
+
$qty = Mage::app()->getLocale()->getNumber($qty);
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Check quantity type
|
| 29 |
+
*/
|
| 30 |
+
$result->setItemIsQtyDecimal($this->getIsQtyDecimal());
|
| 31 |
+
|
| 32 |
+
if (!$this->getIsQtyDecimal()) {
|
| 33 |
+
$result->setHasQtyOptionUpdate(true);
|
| 34 |
+
$qty = intval($qty);
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Adding stock data to quote item
|
| 38 |
+
*/
|
| 39 |
+
$result->setItemQty($qty);
|
| 40 |
+
|
| 41 |
+
if (!is_numeric($qty)) {
|
| 42 |
+
$qty = Mage::app()->getLocale()->getNumber($qty);
|
| 43 |
+
}
|
| 44 |
+
$origQty = intval($origQty);
|
| 45 |
+
$result->setOrigQty($origQty);
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
if ($this->getMinSaleQty() && $qty < $this->getMinSaleQty()) {
|
| 49 |
+
$result->setHasError(true)
|
| 50 |
+
->setMessage(
|
| 51 |
+
Mage::helper('cataloginventory')->__('The minimum quantity allowed for purchase is %s.', $this->getMinSaleQty() * 1)
|
| 52 |
+
)
|
| 53 |
+
->setErrorCode('qty_min')
|
| 54 |
+
->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products cannot be ordered in requested quantity.'))
|
| 55 |
+
->setQuoteMessageIndex('qty');
|
| 56 |
+
return $result;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
if ($this->getMaxSaleQty() && $qty > $this->getMaxSaleQty()) {
|
| 60 |
+
$result->setHasError(true)
|
| 61 |
+
->setMessage(
|
| 62 |
+
Mage::helper('cataloginventory')->__('The maximum quantity allowed for purchase is %s.', $this->getMaxSaleQty() * 1)
|
| 63 |
+
)
|
| 64 |
+
->setErrorCode('qty_max')
|
| 65 |
+
->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products cannot be ordered in requested quantity.'))
|
| 66 |
+
->setQuoteMessageIndex('qty');
|
| 67 |
+
return $result;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
$result->addData($this->checkQtyIncrements($qty)->getData());
|
| 71 |
+
if ($result->getHasError()) {
|
| 72 |
+
return $result;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
if (!$this->getManageStock()) {
|
| 76 |
+
return $result;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
#### For product out of stock checking by developer
|
| 80 |
+
|
| 81 |
+
$credentialsSales = Mage::getStoreConfig('mycustom_section/mycustom_sales_import_group');
|
| 82 |
+
$outofstockFlag = $credentialsSales['mycustom_outofstock_mapping'];
|
| 83 |
+
|
| 84 |
+
$unserielVal = unserialize($outofstockFlag);
|
| 85 |
+
|
| 86 |
+
if(isset($unserielVal['#{_id}']['Stockmapping']) && ($unserielVal['#{_id}']['Stockmapping'] == "No"))
|
| 87 |
+
{
|
| 88 |
+
if (!$this->getIsInStock()) {
|
| 89 |
+
$result->setHasError(true)
|
| 90 |
+
->setMessage(Mage::helper('cataloginventory')->__('This product is currently out of stock.'))
|
| 91 |
+
->setQuoteMessage(Mage::helper('cataloginventory')->__('Some of the products are currently out of stock.'))
|
| 92 |
+
->setQuoteMessageIndex('stock');
|
| 93 |
+
$result->setItemUseOldQty(true);
|
| 94 |
+
return $result;
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
if (!$this->checkQty($summaryQty) || !$this->checkQty($qty)) {
|
| 99 |
+
$message = Mage::helper('cataloginventory')->__('The requested quantity for "%s" is not available.', $this->getProductName());
|
| 100 |
+
$result->setHasError(true)
|
| 101 |
+
->setMessage($message)
|
| 102 |
+
->setQuoteMessage($message)
|
| 103 |
+
->setQuoteMessageIndex('qty');
|
| 104 |
+
return $result;
|
| 105 |
+
} else {
|
| 106 |
+
if (($this->getQty() - $summaryQty) < 0) {
|
| 107 |
+
if ($this->getProductName()) {
|
| 108 |
+
if ($this->getIsChildItem()) {
|
| 109 |
+
$backorderQty = ($this->getQty() > 0) ? ($summaryQty - $this->getQty()) * 1 : $qty * 1;
|
| 110 |
+
if ($backorderQty > $qty) {
|
| 111 |
+
$backorderQty = $qty;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
$result->setItemBackorders($backorderQty);
|
| 115 |
+
} else {
|
| 116 |
+
$orderedItems = $this->getOrderedItems();
|
| 117 |
+
$itemsLeft = ($this->getQty() > $orderedItems) ? ($this->getQty() - $orderedItems) * 1 : 0;
|
| 118 |
+
$backorderQty = ($itemsLeft > 0) ? ($qty - $itemsLeft) * 1 : $qty * 1;
|
| 119 |
+
|
| 120 |
+
if ($backorderQty > 0) {
|
| 121 |
+
$result->setItemBackorders($backorderQty);
|
| 122 |
+
}
|
| 123 |
+
$this->setOrderedItems($orderedItems + $qty);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
if ($this->getBackorders() == Mage_CatalogInventory_Model_Stock::BACKORDERS_YES_NOTIFY) {
|
| 127 |
+
if (!$this->getIsChildItem()) {
|
| 128 |
+
$result->setMessage(
|
| 129 |
+
Mage::helper('cataloginventory')->__('This product is not available in the requested quantity. %s of the items will be backordered.', ($backorderQty * 1))
|
| 130 |
+
);
|
| 131 |
+
} else {
|
| 132 |
+
$result->setMessage(
|
| 133 |
+
Mage::helper('cataloginventory')->__('"%s" is not available in the requested quantity. %s of the items will be backordered.', $this->getProductName(), ($backorderQty * 1))
|
| 134 |
+
);
|
| 135 |
+
}
|
| 136 |
+
} elseif (Mage::app()->getStore()->isAdmin()) {
|
| 137 |
+
$result->setMessage(
|
| 138 |
+
Mage::helper('cataloginventory')->__('The requested quantity for "%s" is not available.', $this->getProductName())
|
| 139 |
+
);
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
} else {
|
| 143 |
+
if (!$this->getIsChildItem()) {
|
| 144 |
+
$this->setOrderedItems($qty + (int)$this->getOrderedItems());
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
return $result;
|
| 150 |
+
}
|
| 151 |
+
}
|
app/code/local/Bluefish/Connection/Model/Checkout/Cart/Api.php
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
require_once 'Mage/Checkout/Model/Cart/Api.php';
|
| 3 |
+
|
| 4 |
+
class Bluefish_Connection_Model_Checkout_Cart_Api extends Mage_Checkout_Model_Cart_Api
|
| 5 |
+
{
|
| 6 |
+
/**
|
| 7 |
+
* Create an order from the shopping cart (quote)
|
| 8 |
+
*
|
| 9 |
+
* @param $quoteId
|
| 10 |
+
* @param $store
|
| 11 |
+
* @param $agreements array
|
| 12 |
+
* @return string
|
| 13 |
+
*/
|
| 14 |
+
public function createOrder($quoteId, $store = null, $agreements = null)
|
| 15 |
+
{
|
| 16 |
+
#### First line added by developer for email not send at the time of order create by api
|
| 17 |
+
Mage::app()->getStore()->setConfig(Mage_Sales_Model_Order::XML_PATH_EMAIL_ENABLED, 0);
|
| 18 |
+
$requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds();
|
| 19 |
+
if (!empty($requiredAgreements)) {
|
| 20 |
+
$diff = array_diff($agreements, $requiredAgreements);
|
| 21 |
+
if (!empty($diff)) {
|
| 22 |
+
$this->_fault('required_agreements_are_not_all');
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
$quote = $this->_getQuote($quoteId, $store);
|
| 27 |
+
if ($quote->getIsMultiShipping()) {
|
| 28 |
+
$this->_fault('invalid_checkout_type');
|
| 29 |
+
}
|
| 30 |
+
if ($quote->getCheckoutMethod() == Mage_Checkout_Model_Api_Resource_Customer::MODE_GUEST
|
| 31 |
+
&& !Mage::helper('checkout')->isAllowedGuestCheckout($quote, $quote->getStoreId())) {
|
| 32 |
+
$this->_fault('guest_checkout_is_not_enabled');
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/** @var $customerResource Mage_Checkout_Model_Api_Resource_Customer */
|
| 36 |
+
$customerResource = Mage::getModel("checkout/api_resource_customer");
|
| 37 |
+
$isNewCustomer = $customerResource->prepareCustomerForQuote($quote);
|
| 38 |
+
|
| 39 |
+
try {
|
| 40 |
+
$quote->collectTotals();
|
| 41 |
+
/** @var $service Mage_Sales_Model_Service_Quote */
|
| 42 |
+
$service = Mage::getModel('sales/service_quote', $quote);
|
| 43 |
+
$service->submitAll();
|
| 44 |
+
|
| 45 |
+
if ($isNewCustomer) {
|
| 46 |
+
try {
|
| 47 |
+
$customerResource->involveNewCustomer($quote);
|
| 48 |
+
} catch (Exception $e) {
|
| 49 |
+
Mage::logException($e);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
$order = $service->getOrder();
|
| 54 |
+
if ($order) {
|
| 55 |
+
Mage::dispatchEvent('checkout_type_onepage_save_order_after',
|
| 56 |
+
array('order' => $order, 'quote' => $quote));
|
| 57 |
+
|
| 58 |
+
try {
|
| 59 |
+
$order->sendNewOrderEmail();
|
| 60 |
+
} catch (Exception $e) {
|
| 61 |
+
Mage::logException($e);
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
Mage::dispatchEvent(
|
| 66 |
+
'checkout_submit_all_after',
|
| 67 |
+
array('order' => $order, 'quote' => $quote)
|
| 68 |
+
);
|
| 69 |
+
} catch (Mage_Core_Exception $e) {
|
| 70 |
+
$this->_fault('create_order_fault', $e->getMessage());
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
return $order->getIncrementId();
|
| 74 |
+
}
|
| 75 |
+
}
|
app/code/local/Bluefish/Connection/Model/Cronobserver.php
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/***************************/
|
| 3 |
+
##### This File Is Used For Calling The Corresponding Action Method From Interface
|
| 4 |
+
/***************************/
|
| 5 |
+
|
| 6 |
+
require_once Mage::getModuleDir('controllers', 'Bluefish_Connection').'/Adminhtml/MyformController.php';
|
| 7 |
+
|
| 8 |
+
class Bluefish_Connection_Model_Cronobserver extends Bluefish_Connection_Adminhtml_MyformController
|
| 9 |
+
{
|
| 10 |
+
public function _construct()
|
| 11 |
+
{
|
| 12 |
+
}
|
| 13 |
+
public function trimExplodeBluefish($delim, $string, $removeEmptyValues=false) {
|
| 14 |
+
$explodedValues = explode($delim, $string);
|
| 15 |
+
|
| 16 |
+
$result = array_map('trim', $explodedValues);
|
| 17 |
+
|
| 18 |
+
if ($removeEmptyValues) {
|
| 19 |
+
$temp = array();
|
| 20 |
+
foreach ($result as $value) {
|
| 21 |
+
if ($value !== '') {
|
| 22 |
+
$temp[] = $value;
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
$result = $temp;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
return $result;
|
| 29 |
+
}
|
| 30 |
+
public function isDisabled($jobCode) {
|
| 31 |
+
$disabledJobs = Mage::getStoreConfig('system/cron/disabled_crons');
|
| 32 |
+
$disabledJobs = $this->trimExplodeBluefish(',', $disabledJobs);
|
| 33 |
+
if(in_array($jobCode, $disabledJobs))
|
| 34 |
+
{
|
| 35 |
+
$cron_schedule = Mage::getSingleton('core/resource')->getTableName('cron_schedule');
|
| 36 |
+
$conn = Mage::getSingleton('core/resource')->getConnection('core_read');
|
| 37 |
+
$conn->query("
|
| 38 |
+
DELETE
|
| 39 |
+
FROM {$cron_schedule}
|
| 40 |
+
WHERE status = 'pending' AND job_code = '$jobCode'
|
| 41 |
+
");
|
| 42 |
+
return true;
|
| 43 |
+
}
|
| 44 |
+
else
|
| 45 |
+
{
|
| 46 |
+
return false;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function categoryImport() ### This Function is used for category Import
|
| 51 |
+
{
|
| 52 |
+
if ($this->isDisabled('bluefish_connection_category')) {
|
| 53 |
+
die();
|
| 54 |
+
}
|
| 55 |
+
$this->postAction('1');
|
| 56 |
+
}
|
| 57 |
+
public function productImport() ### This Function is used for product Import
|
| 58 |
+
{
|
| 59 |
+
if ($this->isDisabled('bluefish_connection_product')) {
|
| 60 |
+
die();
|
| 61 |
+
}
|
| 62 |
+
$this->postAction('2');
|
| 63 |
+
}
|
| 64 |
+
public function productEmport() ### This Function is used for product Export
|
| 65 |
+
{
|
| 66 |
+
if ($this->isDisabled('bluefish_connection_productexport')) {
|
| 67 |
+
die();
|
| 68 |
+
}
|
| 69 |
+
$this->postAction('9');
|
| 70 |
+
}
|
| 71 |
+
public function stockImport() ### This Function is used for stock Import
|
| 72 |
+
{
|
| 73 |
+
if ($this->isDisabled('bluefish_connection_stock')) {
|
| 74 |
+
die();
|
| 75 |
+
}
|
| 76 |
+
$this->postAction('3');
|
| 77 |
+
}
|
| 78 |
+
public function customerImport() ### This Function is used for customers Import
|
| 79 |
+
{
|
| 80 |
+
if ($this->isDisabled('bluefish_connection_customer')) {
|
| 81 |
+
die();
|
| 82 |
+
}
|
| 83 |
+
$this->postAction('4');
|
| 84 |
+
}
|
| 85 |
+
public function customerExport() ### This Function is used for customer data Export
|
| 86 |
+
{
|
| 87 |
+
if ($this->isDisabled('bluefish_connection_customerexport')) {
|
| 88 |
+
die();
|
| 89 |
+
}
|
| 90 |
+
$this->postAction('6');
|
| 91 |
+
}
|
| 92 |
+
public function salesImport() ### This Function is used for sale Import
|
| 93 |
+
{
|
| 94 |
+
if ($this->isDisabled('bluefish_connection_orderimport')) {
|
| 95 |
+
die();
|
| 96 |
+
}
|
| 97 |
+
$this->postAction('8');
|
| 98 |
+
}
|
| 99 |
+
public function salesExport() ### This Function is used for sale Export
|
| 100 |
+
{
|
| 101 |
+
if ($this->isDisabled('bluefish_connection_orderexport')) {
|
| 102 |
+
die();
|
| 103 |
+
}
|
| 104 |
+
$this->postAction('5');
|
| 105 |
+
}
|
| 106 |
+
public function categoryCSVExport() ### This Function is used for customer data Export
|
| 107 |
+
{
|
| 108 |
+
$this->postAction('7');
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
?>
|
app/code/local/Bluefish/Connection/Model/Observer.php
CHANGED
|
@@ -1,104 +1,273 @@
|
|
| 1 |
<?php
|
| 2 |
-
/***************************/
|
| 3 |
-
##### This File Is Used For Calling The Corresponding Action Method From Interface
|
| 4 |
-
/***************************/
|
| 5 |
|
| 6 |
-
require_once Mage
|
| 7 |
|
| 8 |
-
class Bluefish_Connection_Model_Observer extends
|
| 9 |
{
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
}
|
| 13 |
-
|
| 14 |
-
$explodedValues = explode($delim, $string);
|
| 15 |
-
|
| 16 |
-
$result = array_map('trim', $explodedValues);
|
| 17 |
-
|
| 18 |
-
if ($removeEmptyValues) {
|
| 19 |
-
$temp = array();
|
| 20 |
-
foreach ($result as $value) {
|
| 21 |
-
if ($value !== '') {
|
| 22 |
-
$temp[] = $value;
|
| 23 |
-
}
|
| 24 |
-
}
|
| 25 |
-
$result = $temp;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
return $result;
|
| 29 |
-
}
|
| 30 |
-
public function isDisabled($jobCode) {
|
| 31 |
-
$disabledJobs = Mage::getStoreConfig('system/cron/disabled_crons');
|
| 32 |
-
$disabledJobs = $this->trimExplodeBluefish(',', $disabledJobs);
|
| 33 |
-
if(in_array($jobCode, $disabledJobs))
|
| 34 |
-
{
|
| 35 |
-
$cron_schedule = Mage::getSingleton('core/resource')->getTableName('cron_schedule');
|
| 36 |
-
$conn = Mage::getSingleton('core/resource')->getConnection('core_read');
|
| 37 |
-
$conn->query("
|
| 38 |
-
DELETE
|
| 39 |
-
FROM {$cron_schedule}
|
| 40 |
-
WHERE status = 'pending' AND job_code = '$jobCode'
|
| 41 |
-
");
|
| 42 |
-
return true;
|
| 43 |
-
}
|
| 44 |
-
else
|
| 45 |
-
{
|
| 46 |
-
return false;
|
| 47 |
-
}
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
public function categoryImport() ### This Function is used for category Import
|
| 51 |
-
{
|
| 52 |
-
if ($this->isDisabled('bluefish_connection_category')) {
|
| 53 |
-
die();
|
| 54 |
-
}
|
| 55 |
-
$this->postAction('1');
|
| 56 |
-
}
|
| 57 |
-
public function productImport() ### This Function is used for product Import
|
| 58 |
-
{
|
| 59 |
-
if ($this->isDisabled('bluefish_connection_product')) {
|
| 60 |
-
die();
|
| 61 |
-
}
|
| 62 |
-
$this->postAction('2');
|
| 63 |
-
}
|
| 64 |
-
public function stockImport() ### This Function is used for stock Import
|
| 65 |
-
{
|
| 66 |
-
if ($this->isDisabled('bluefish_connection_stock')) {
|
| 67 |
-
die();
|
| 68 |
-
}
|
| 69 |
-
$this->postAction('3');
|
| 70 |
-
}
|
| 71 |
-
public function customerImport() ### This Function is used for stock Import
|
| 72 |
-
{
|
| 73 |
-
if ($this->isDisabled('bluefish_connection_customer')) {
|
| 74 |
-
die();
|
| 75 |
-
}
|
| 76 |
-
$this->postAction('4');
|
| 77 |
-
}
|
| 78 |
-
public function salesExport() ### This Function is used for sale Export
|
| 79 |
-
{
|
| 80 |
-
if ($this->isDisabled('bluefish_connection_orderexport')) {
|
| 81 |
-
die();
|
| 82 |
-
}
|
| 83 |
-
$this->postAction('5');
|
| 84 |
-
}
|
| 85 |
-
public function customerExport() ### This Function is used for customer data Export
|
| 86 |
-
{
|
| 87 |
-
if ($this->isDisabled('bluefish_connection_customerexport')) {
|
| 88 |
-
die();
|
| 89 |
-
}
|
| 90 |
-
$this->postAction('6');
|
| 91 |
-
}
|
| 92 |
-
public function categoryCSVExport() ### This Function is used for customer data Export
|
| 93 |
-
{
|
| 94 |
-
$this->postAction('7');
|
| 95 |
-
}
|
| 96 |
-
public function salesImport() ### This Function is used for sale Export
|
| 97 |
-
{
|
| 98 |
-
if ($this->isDisabled('bluefish_connection_orderimport')) {
|
| 99 |
-
die();
|
| 100 |
-
}
|
| 101 |
-
$this->postAction('8');
|
| 102 |
-
}
|
| 103 |
-
}
|
| 104 |
-
?>
|
| 1 |
<?php
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
require_once 'Mage/CatalogInventory/Model/Observer.php';
|
| 4 |
|
| 5 |
+
class Bluefish_Connection_Model_Observer extends Mage_CatalogInventory_Model_Observer
|
| 6 |
{
|
| 7 |
+
/**
|
| 8 |
+
* Check product inventory data when quote item quantity declaring
|
| 9 |
+
*
|
| 10 |
+
* @param Varien_Event_Observer $observer
|
| 11 |
+
* @return Mage_CatalogInventory_Model_Observer
|
| 12 |
+
*/
|
| 13 |
+
public function checkQuoteItemQty($observer)
|
| 14 |
{
|
| 15 |
+
$quoteItem = $observer->getEvent()->getItem();
|
| 16 |
+
/* @var $quoteItem Mage_Sales_Model_Quote_Item */
|
| 17 |
+
if (!$quoteItem || !$quoteItem->getProductId() || !$quoteItem->getQuote()
|
| 18 |
+
|| $quoteItem->getQuote()->getIsSuperMode()) {
|
| 19 |
+
return $this;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Get Qty
|
| 24 |
+
*/
|
| 25 |
+
$qty = $quoteItem->getQty();
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Check if product in stock. For composite products check base (parent) item stosk status
|
| 29 |
+
*/
|
| 30 |
+
$stockItem = $quoteItem->getProduct()->getStockItem();
|
| 31 |
+
$parentStockItem = false;
|
| 32 |
+
if ($quoteItem->getParentItem()) {
|
| 33 |
+
$parentStockItem = $quoteItem->getParentItem()->getProduct()->getStockItem();
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
#### For product out of stock checking by developer
|
| 38 |
+
$credentialsSales = Mage::getStoreConfig('mycustom_section/mycustom_sales_import_group');
|
| 39 |
+
$outofstockFlag = $credentialsSales['mycustom_outofstock_mapping'];
|
| 40 |
+
|
| 41 |
+
$unserielVal = unserialize($outofstockFlag);
|
| 42 |
+
|
| 43 |
+
if(isset($unserielVal['#{_id}']['Stockmapping']) && ($unserielVal['#{_id}']['Stockmapping'] == "No"))
|
| 44 |
+
{
|
| 45 |
+
if ($stockItem) {
|
| 46 |
+
if (!$stockItem->getIsInStock() || ($parentStockItem && !$parentStockItem->getIsInStock())) {
|
| 47 |
+
$quoteItem->addErrorInfo(
|
| 48 |
+
'cataloginventory',
|
| 49 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY,
|
| 50 |
+
Mage::helper('cataloginventory')->__('This product is currently out of stock.')
|
| 51 |
+
);
|
| 52 |
+
$quoteItem->getQuote()->addErrorInfo(
|
| 53 |
+
'stock',
|
| 54 |
+
'cataloginventory',
|
| 55 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY,
|
| 56 |
+
Mage::helper('cataloginventory')->__('Some of the products are currently out of stock.')
|
| 57 |
+
);
|
| 58 |
+
return $this;
|
| 59 |
+
} else {
|
| 60 |
+
// Delete error from item and its quote, if it was set due to item out of stock
|
| 61 |
+
$this->_removeErrorsFromQuoteAndItem($quoteItem, Mage_CatalogInventory_Helper_Data::ERROR_QTY);
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* Check item for options
|
| 68 |
+
*/
|
| 69 |
+
if (($options = $quoteItem->getQtyOptions()) && $qty > 0) {
|
| 70 |
+
$qty = $quoteItem->getProduct()->getTypeInstance(true)->prepareQuoteItemQty($qty, $quoteItem->getProduct());
|
| 71 |
+
$quoteItem->setData('qty', $qty);
|
| 72 |
+
|
| 73 |
+
if ($stockItem) {
|
| 74 |
+
$result = $stockItem->checkQtyIncrements($qty);
|
| 75 |
+
if ($result->getHasError()) {
|
| 76 |
+
$quoteItem->addErrorInfo(
|
| 77 |
+
'cataloginventory',
|
| 78 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY_INCREMENTS,
|
| 79 |
+
$result->getMessage()
|
| 80 |
+
);
|
| 81 |
+
|
| 82 |
+
$quoteItem->getQuote()->addErrorInfo(
|
| 83 |
+
$result->getQuoteMessageIndex(),
|
| 84 |
+
'cataloginventory',
|
| 85 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY_INCREMENTS,
|
| 86 |
+
$result->getQuoteMessage()
|
| 87 |
+
);
|
| 88 |
+
} else {
|
| 89 |
+
// Delete error from item and its quote, if it was set due to qty problems
|
| 90 |
+
$this->_removeErrorsFromQuoteAndItem(
|
| 91 |
+
$quoteItem,
|
| 92 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY_INCREMENTS
|
| 93 |
+
);
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
foreach ($options as $option) {
|
| 98 |
+
$optionValue = $option->getValue();
|
| 99 |
+
/* @var $option Mage_Sales_Model_Quote_Item_Option */
|
| 100 |
+
$optionQty = $qty * $optionValue;
|
| 101 |
+
$increaseOptionQty = ($quoteItem->getQtyToAdd() ? $quoteItem->getQtyToAdd() : $qty) * $optionValue;
|
| 102 |
+
|
| 103 |
+
$stockItem = $option->getProduct()->getStockItem();
|
| 104 |
+
|
| 105 |
+
if ($quoteItem->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
|
| 106 |
+
$stockItem->setProductName($quoteItem->getName());
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */
|
| 110 |
+
if (!$stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) {
|
| 111 |
+
Mage::throwException(
|
| 112 |
+
Mage::helper('cataloginventory')->__('The stock item for Product in option is not valid.')
|
| 113 |
+
);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* define that stock item is child for composite product
|
| 118 |
+
*/
|
| 119 |
+
$stockItem->setIsChildItem(true);
|
| 120 |
+
/**
|
| 121 |
+
* don't check qty increments value for option product
|
| 122 |
+
*/
|
| 123 |
+
$stockItem->setSuppressCheckQtyIncrements(true);
|
| 124 |
+
|
| 125 |
+
$qtyForCheck = $this->_getQuoteItemQtyForCheck(
|
| 126 |
+
$option->getProduct()->getId(),
|
| 127 |
+
$quoteItem->getId(),
|
| 128 |
+
$increaseOptionQty
|
| 129 |
+
);
|
| 130 |
+
|
| 131 |
+
$result = $stockItem->checkQuoteItemQty($optionQty, $qtyForCheck, $optionValue);
|
| 132 |
+
|
| 133 |
+
if (!is_null($result->getItemIsQtyDecimal())) {
|
| 134 |
+
$option->setIsQtyDecimal($result->getItemIsQtyDecimal());
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
if ($result->getHasQtyOptionUpdate()) {
|
| 138 |
+
$option->setHasQtyOptionUpdate(true);
|
| 139 |
+
$quoteItem->updateQtyOption($option, $result->getOrigQty());
|
| 140 |
+
$option->setValue($result->getOrigQty());
|
| 141 |
+
/**
|
| 142 |
+
* if option's qty was updates we also need to update quote item qty
|
| 143 |
+
*/
|
| 144 |
+
$quoteItem->setData('qty', intval($qty));
|
| 145 |
+
}
|
| 146 |
+
if (!is_null($result->getMessage())) {
|
| 147 |
+
$option->setMessage($result->getMessage());
|
| 148 |
+
$quoteItem->setMessage($result->getMessage());
|
| 149 |
+
}
|
| 150 |
+
if (!is_null($result->getItemBackorders())) {
|
| 151 |
+
$option->setBackorders($result->getItemBackorders());
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
if ($result->getHasError()) {
|
| 155 |
+
$option->setHasError(true);
|
| 156 |
+
|
| 157 |
+
$quoteItem->addErrorInfo(
|
| 158 |
+
'cataloginventory',
|
| 159 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY,
|
| 160 |
+
$result->getMessage()
|
| 161 |
+
);
|
| 162 |
+
|
| 163 |
+
$quoteItem->getQuote()->addErrorInfo(
|
| 164 |
+
$result->getQuoteMessageIndex(),
|
| 165 |
+
'cataloginventory',
|
| 166 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY,
|
| 167 |
+
$result->getQuoteMessage()
|
| 168 |
+
);
|
| 169 |
+
} else {
|
| 170 |
+
// Delete error from item and its quote, if it was set due to qty lack
|
| 171 |
+
$this->_removeErrorsFromQuoteAndItem($quoteItem, Mage_CatalogInventory_Helper_Data::ERROR_QTY);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
$stockItem->unsIsChildItem();
|
| 175 |
+
}
|
| 176 |
+
} else {
|
| 177 |
+
/* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */
|
| 178 |
+
if (!$stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) {
|
| 179 |
+
Mage::throwException(Mage::helper('cataloginventory')->__('The stock item for Product is not valid.'));
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* When we work with subitem (as subproduct of bundle or configurable product)
|
| 184 |
+
*/
|
| 185 |
+
if ($quoteItem->getParentItem()) {
|
| 186 |
+
$rowQty = $quoteItem->getParentItem()->getQty() * $qty;
|
| 187 |
+
/**
|
| 188 |
+
* we are using 0 because original qty was processed
|
| 189 |
+
*/
|
| 190 |
+
$qtyForCheck = $this->_getQuoteItemQtyForCheck(
|
| 191 |
+
$quoteItem->getProduct()->getId(),
|
| 192 |
+
$quoteItem->getId(),
|
| 193 |
+
0
|
| 194 |
+
);
|
| 195 |
+
} else {
|
| 196 |
+
$increaseQty = $quoteItem->getQtyToAdd() ? $quoteItem->getQtyToAdd() : $qty;
|
| 197 |
+
$rowQty = $qty;
|
| 198 |
+
$qtyForCheck = $this->_getQuoteItemQtyForCheck(
|
| 199 |
+
$quoteItem->getProduct()->getId(),
|
| 200 |
+
$quoteItem->getId(),
|
| 201 |
+
$increaseQty
|
| 202 |
+
);
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
$productTypeCustomOption = $quoteItem->getProduct()->getCustomOption('product_type');
|
| 206 |
+
if (!is_null($productTypeCustomOption)) {
|
| 207 |
+
// Check if product related to current item is a part of grouped product
|
| 208 |
+
if ($productTypeCustomOption->getValue() == Mage_Catalog_Model_Product_Type_Grouped::TYPE_CODE) {
|
| 209 |
+
$stockItem->setProductName($quoteItem->getProduct()->getName());
|
| 210 |
+
$stockItem->setIsChildItem(true);
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
$result = $stockItem->checkQuoteItemQty($rowQty, $qtyForCheck, $qty);
|
| 215 |
+
|
| 216 |
+
if ($stockItem->hasIsChildItem()) {
|
| 217 |
+
$stockItem->unsIsChildItem();
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
if (!is_null($result->getItemIsQtyDecimal())) {
|
| 221 |
+
$quoteItem->setIsQtyDecimal($result->getItemIsQtyDecimal());
|
| 222 |
+
if ($quoteItem->getParentItem()) {
|
| 223 |
+
$quoteItem->getParentItem()->setIsQtyDecimal($result->getItemIsQtyDecimal());
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Just base (parent) item qty can be changed
|
| 229 |
+
* qty of child products are declared just during add process
|
| 230 |
+
* exception for updating also managed by product type
|
| 231 |
+
*/
|
| 232 |
+
if ($result->getHasQtyOptionUpdate()
|
| 233 |
+
&& (!$quoteItem->getParentItem()
|
| 234 |
+
|| $quoteItem->getParentItem()->getProduct()->getTypeInstance(true)
|
| 235 |
+
->getForceChildItemQtyChanges($quoteItem->getParentItem()->getProduct())
|
| 236 |
+
)
|
| 237 |
+
) {
|
| 238 |
+
$quoteItem->setData('qty', $result->getOrigQty());
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
if (!is_null($result->getItemUseOldQty())) {
|
| 242 |
+
$quoteItem->setUseOldQty($result->getItemUseOldQty());
|
| 243 |
+
}
|
| 244 |
+
if (!is_null($result->getMessage())) {
|
| 245 |
+
$quoteItem->setMessage($result->getMessage());
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
if (!is_null($result->getItemBackorders())) {
|
| 249 |
+
$quoteItem->setBackorders($result->getItemBackorders());
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
if ($result->getHasError()) {
|
| 253 |
+
$quoteItem->addErrorInfo(
|
| 254 |
+
'cataloginventory',
|
| 255 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY,
|
| 256 |
+
$result->getMessage()
|
| 257 |
+
);
|
| 258 |
+
|
| 259 |
+
$quoteItem->getQuote()->addErrorInfo(
|
| 260 |
+
$result->getQuoteMessageIndex(),
|
| 261 |
+
'cataloginventory',
|
| 262 |
+
Mage_CatalogInventory_Helper_Data::ERROR_QTY,
|
| 263 |
+
$result->getQuoteMessage()
|
| 264 |
+
);
|
| 265 |
+
} else {
|
| 266 |
+
// Delete error from item and its quote, if it was set due to qty lack
|
| 267 |
+
$this->_removeErrorsFromQuoteAndItem($quoteItem, Mage_CatalogInventory_Helper_Data::ERROR_QTY);
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
return $this;
|
| 272 |
}
|
| 273 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Bluefish/Connection/Model/Validationcrontime.php
CHANGED
|
@@ -36,71 +36,130 @@ class Bluefish_Connection_Model_Validationcrontime extends Mage_Adminhtml_Model_
|
|
| 36 |
*/
|
| 37 |
protected function _beforeSave()
|
| 38 |
{
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
{
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
break;
|
| 64 |
-
case "mycustom_section/mycustom_product_group/mycustom_product_commonschedule":
|
| 65 |
-
$markers = $doc->getElementsByTagName('bluefish_connection_product');
|
| 66 |
-
break;
|
| 67 |
-
case "mycustom_section/mycustom_stock_group/mycustom_stock_commonschedule":
|
| 68 |
-
$markers = $doc->getElementsByTagName('bluefish_connection_stock');
|
| 69 |
-
break;
|
| 70 |
-
case "mycustom_section/mycustom_customer_group/mycustom_customer_commonschedule":
|
| 71 |
-
$markers = $doc->getElementsByTagName('bluefish_connection_customer');
|
| 72 |
-
$markersCustomer = $doc->getElementsByTagName('bluefish_connection_customerexport');
|
| 73 |
-
break;
|
| 74 |
-
case "mycustom_section/mycustom_sales_group/mycustom_sales_commonschedule":
|
| 75 |
-
$markers = $doc->getElementsByTagName('bluefish_connection_orderexport');
|
| 76 |
-
$markersSales = $doc->getElementsByTagName('bluefish_connection_orderimport');
|
| 77 |
-
break;
|
| 78 |
}
|
| 79 |
-
$countNum
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
{
|
| 85 |
-
|
| 86 |
{
|
| 87 |
-
$
|
| 88 |
-
$Minutecronconfig = $valueconfig['Minutecronconfig'];
|
| 89 |
}
|
| 90 |
-
$countNum++;
|
| 91 |
}
|
| 92 |
-
|
| 93 |
{
|
| 94 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
}
|
| 96 |
else
|
| 97 |
{
|
| 98 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
}
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
if(count($resultCronPath) == 0 || $resultCronPath[0]['loopCounter'] == '0')
|
| 103 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
if(isset($markersCustomer))
|
| 105 |
{
|
| 106 |
foreach($markersCustomer as $marker)
|
|
@@ -120,55 +179,11 @@ class Bluefish_Connection_Model_Validationcrontime extends Mage_Adminhtml_Model_
|
|
| 120 |
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 121 |
}
|
| 122 |
$doc->saveXML();
|
| 123 |
-
$doc->save($xmlFile);
|
| 124 |
-
$loopIteration = '1';
|
| 125 |
-
|
| 126 |
-
if($resultCronPath[0]['loopCounter'] != 0)
|
| 127 |
-
{
|
| 128 |
-
$connection->query("INSERT INTO ".$prefix."bluefish_cron_schedule(id,cronPath,loopCounter,loopIteration)
|
| 129 |
-
VALUES('','".$cronPath."','".$loopCounter."','".$loopIteration."')");
|
| 130 |
-
}
|
| 131 |
-
else
|
| 132 |
-
{
|
| 133 |
-
if(($loopCounter == '0') || ($resultCronPath[0]['loopIteration'] > $loopCounter ))
|
| 134 |
-
{
|
| 135 |
-
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopIteration= '".$loopIteration."' where cronPath = '".$cronPath."'");
|
| 136 |
-
}
|
| 137 |
-
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopCounter= '".$loopCounter."' where cronPath = '".$cronPath."'");
|
| 138 |
-
}
|
| 139 |
-
}
|
| 140 |
-
else
|
| 141 |
-
{
|
| 142 |
-
if(($loopCounter == '0') || ($resultCronPath[0]['loopIteration'] > $loopCounter ))
|
| 143 |
-
{
|
| 144 |
-
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopIteration= '0' where cronPath = '".$cronPath."'");
|
| 145 |
-
}
|
| 146 |
-
else if($loopCounter == '1')
|
| 147 |
-
{
|
| 148 |
-
if(isset($markersCustomer))
|
| 149 |
-
{
|
| 150 |
-
foreach($markersCustomer as $marker)
|
| 151 |
-
{
|
| 152 |
-
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 153 |
-
}
|
| 154 |
-
}
|
| 155 |
-
if(isset($markersSales))
|
| 156 |
-
{
|
| 157 |
-
foreach($markersSales as $marker)
|
| 158 |
-
{
|
| 159 |
-
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 160 |
-
}
|
| 161 |
-
}
|
| 162 |
-
foreach($markers as $marker)
|
| 163 |
-
{
|
| 164 |
-
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 165 |
-
}
|
| 166 |
-
$doc->saveXML();
|
| 167 |
-
$doc->save($xmlFile);
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopCounter= '".$loopCounter."' where cronPath = '".$cronPath."'");
|
| 171 |
}
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
$this->setValue($value);
|
| 174 |
parent::_beforeSave();
|
| 36 |
*/
|
| 37 |
protected function _beforeSave()
|
| 38 |
{
|
| 39 |
+
$value = $this->getValue();
|
| 40 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 41 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 42 |
|
| 43 |
+
if (is_array($value)) {
|
| 44 |
+
unset($value['__empty']);
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
$cronPath = $this->getPath();
|
| 48 |
+
$loopCounter = count($value);
|
| 49 |
+
|
| 50 |
+
$resultPath = $connection->query("select id,loopCounter,loopIteration from ".$prefix."bluefish_cron_schedule WHERE cronPath = '".$cronPath."'");
|
| 51 |
+
$resultCronPath = $resultPath->fetchAll(PDO::FETCH_ASSOC);
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
$doc = new DOMDocument();
|
| 55 |
+
$varpath = dirname(dirname(dirname(__FILE__)));
|
| 56 |
+
$xmlFile = "$varpath/Connection/etc/config.xml";
|
| 57 |
+
$doc->load($xmlFile);
|
| 58 |
|
| 59 |
+
switch ($cronPath)
|
| 60 |
+
{
|
| 61 |
+
case "mycustom_section/mycustom_category_group/mycustom_category_defaultminuteschedule":
|
| 62 |
+
$markers = $doc->getElementsByTagName('bluefish_connection_category');
|
| 63 |
+
break;
|
| 64 |
+
case "mycustom_section/mycustom_product_group/mycustom_product_commonschedule":
|
| 65 |
+
$markers = $doc->getElementsByTagName('bluefish_connection_product');
|
| 66 |
+
$markersProduct = $doc->getElementsByTagName('bluefish_connection_productexport');
|
| 67 |
+
break;
|
| 68 |
+
case "mycustom_section/mycustom_stock_group/mycustom_stock_commonschedule":
|
| 69 |
+
$markers = $doc->getElementsByTagName('bluefish_connection_stock');
|
| 70 |
+
break;
|
| 71 |
+
case "mycustom_section/mycustom_customer_group/mycustom_customer_commonschedule":
|
| 72 |
+
$markers = $doc->getElementsByTagName('bluefish_connection_customer');
|
| 73 |
+
$markersCustomer = $doc->getElementsByTagName('bluefish_connection_customerexport');
|
| 74 |
+
break;
|
| 75 |
+
case "mycustom_section/mycustom_sales_group/mycustom_sales_commonschedule":
|
| 76 |
+
$markers = $doc->getElementsByTagName('bluefish_connection_orderexport');
|
| 77 |
+
$markersSales = $doc->getElementsByTagName('bluefish_connection_orderimport');
|
| 78 |
+
break;
|
| 79 |
+
}
|
| 80 |
+
$countNum = 0;
|
| 81 |
+
$Minutecronconfig = "";
|
| 82 |
+
$Hourcronconfig = "";
|
| 83 |
+
|
| 84 |
+
foreach($value as $key => $valueconfig)
|
| 85 |
+
{
|
| 86 |
+
if($countNum == 0)
|
| 87 |
{
|
| 88 |
+
$Hourcronconfig = $valueconfig['Hourcronconfig'];
|
| 89 |
+
$Minutecronconfig = $valueconfig['Minutecronconfig'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
+
$countNum++;
|
| 92 |
+
}
|
| 93 |
+
if($Minutecronconfig == "" && $Hourcronconfig == "")
|
| 94 |
+
{
|
| 95 |
+
$cron_schedule_time = "0 0 * * *";
|
| 96 |
+
}
|
| 97 |
+
else
|
| 98 |
+
{
|
| 99 |
+
$cron_schedule_time = $Minutecronconfig." ".$Hourcronconfig." * * *";
|
| 100 |
+
}
|
| 101 |
|
| 102 |
+
|
| 103 |
+
if(count($resultCronPath) == 0 || $resultCronPath[0]['loopCounter'] == 0)
|
| 104 |
+
{
|
| 105 |
+
if(isset($markersProduct))
|
| 106 |
+
{
|
| 107 |
+
foreach($markersProduct as $marker)
|
| 108 |
+
{
|
| 109 |
+
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 110 |
+
}
|
| 111 |
+
}
|
| 112 |
+
if(isset($markersCustomer))
|
| 113 |
+
{
|
| 114 |
+
foreach($markersCustomer as $marker)
|
| 115 |
+
{
|
| 116 |
+
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
if(isset($markersSales))
|
| 120 |
{
|
| 121 |
+
foreach($markersSales as $marker)
|
| 122 |
{
|
| 123 |
+
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
|
|
|
| 124 |
}
|
|
|
|
| 125 |
}
|
| 126 |
+
foreach($markers as $marker)
|
| 127 |
{
|
| 128 |
+
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 129 |
+
}
|
| 130 |
+
$doc->saveXML();
|
| 131 |
+
$doc->save($xmlFile);
|
| 132 |
+
$loopIteration = '1';
|
| 133 |
+
|
| 134 |
+
if($resultCronPath[0]['loopCounter'] != '0')
|
| 135 |
+
{
|
| 136 |
+
$connection->query("INSERT INTO ".$prefix."bluefish_cron_schedule(id,cronPath,loopCounter,loopIteration)
|
| 137 |
+
VALUES('','".$cronPath."','".$loopCounter."','".$loopIteration."')");
|
| 138 |
}
|
| 139 |
else
|
| 140 |
{
|
| 141 |
+
if(($loopCounter == '0') || ($resultCronPath[0]['loopIteration'] > $loopCounter ))
|
| 142 |
+
{
|
| 143 |
+
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopIteration= '".$loopIteration."' where cronPath = '".$cronPath."'");
|
| 144 |
+
}
|
| 145 |
+
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopCounter= '".$loopCounter."' where cronPath = '".$cronPath."'");
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
else
|
| 149 |
+
{
|
| 150 |
+
if(($loopCounter == '0') || ($resultCronPath[0]['loopIteration'] > $loopCounter ))
|
| 151 |
+
{
|
| 152 |
+
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopIteration= '1' where cronPath = '".$cronPath."'");
|
| 153 |
}
|
| 154 |
+
else if($loopCounter == '1')
|
|
|
|
|
|
|
| 155 |
{
|
| 156 |
+
if(isset($markersProduct))
|
| 157 |
+
{
|
| 158 |
+
foreach($markersProduct as $marker)
|
| 159 |
+
{
|
| 160 |
+
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 161 |
+
}
|
| 162 |
+
}
|
| 163 |
if(isset($markersCustomer))
|
| 164 |
{
|
| 165 |
foreach($markersCustomer as $marker)
|
| 179 |
$type = $marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $cron_schedule_time;
|
| 180 |
}
|
| 181 |
$doc->saveXML();
|
| 182 |
+
$doc->save($xmlFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
}
|
| 184 |
+
|
| 185 |
+
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopCounter= '".$loopCounter."' where cronPath = '".$cronPath."'");
|
| 186 |
+
}
|
| 187 |
|
| 188 |
$this->setValue($value);
|
| 189 |
parent::_beforeSave();
|
app/code/local/Bluefish/Connection/controllers/Adminhtml/MyformController.php
CHANGED
|
@@ -11,19 +11,20 @@ include("Xml.php");
|
|
| 11 |
class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
|
| 12 |
{
|
| 13 |
public static $flag = 0;
|
| 14 |
-
#### Bluestore Live Path For GET and POST Data
|
| 15 |
-
const CATEGORY
|
| 16 |
-
const PRODUCT
|
| 17 |
-
const STOCK
|
| 18 |
const CUSTOMER = 'https://bluestorelive.com:9001/rest/customer/';
|
| 19 |
-
const ORDERPOST
|
| 20 |
const CUSTOMERPOST = 'https://bluestorelive.com:9001/rest/inbound/';
|
| 21 |
-
const SALEIMPORT
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
|
| 28 |
### Function For Write Bluestore Category Data into categories_bluefish.xml File
|
| 29 |
public function xmlAction($response)
|
|
@@ -224,7 +225,7 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 224 |
}
|
| 225 |
|
| 226 |
### Function For Write Bluestore Sale Data into sales_bluestore.xml File
|
| 227 |
-
public function xmlActionSale($response)
|
| 228 |
{
|
| 229 |
$appBaseDir = Mage::getBaseDir();
|
| 230 |
$xmlFiles = $appBaseDir."/sales_bluestore_import.xml";
|
|
@@ -254,7 +255,7 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 254 |
}
|
| 255 |
else
|
| 256 |
{
|
| 257 |
-
$result_database = importBluestoreSales();
|
| 258 |
if($result_database == "fail")
|
| 259 |
{
|
| 260 |
$this->flag=6;
|
|
@@ -407,94 +408,261 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 407 |
else
|
| 408 |
{
|
| 409 |
$custRdata = $appBaseDir."/customer_bluestore_request.xml";
|
| 410 |
-
$cfrequest
|
| 411 |
-
|
| 412 |
-
|
|
|
|
|
|
|
|
|
|
| 413 |
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
$auth_query = $baseurl;
|
| 418 |
-
|
| 419 |
-
$header = array(
|
| 420 |
-
'Accept: application/xml',
|
| 421 |
-
'Content-Type: application/xml',
|
| 422 |
-
'Expect:'
|
| 423 |
-
);
|
| 424 |
-
$header = array_merge($auth2,$header);
|
| 425 |
-
|
| 426 |
-
$tuCurl = curl_init();
|
| 427 |
-
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 428 |
-
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 429 |
-
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 430 |
-
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 431 |
-
curl_setopt($tuCurl, CURLOPT_POST, 1);
|
| 432 |
-
curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $xml);
|
| 433 |
-
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, false);
|
| 434 |
-
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
|
| 435 |
-
curl_setopt($tuCurl, CURLOPT_FOLLOWLOCATION, 1);
|
| 436 |
-
curl_setopt($tuCurl, CURLINFO_HEADER_OUT, TRUE);
|
| 437 |
-
curl_setopt($tuCurl, CURLOPT_HTTPHEADER,$header);
|
| 438 |
-
$response = curl_exec($tuCurl);
|
| 439 |
-
$response1 = curl_getinfo( $tuCurl );
|
| 440 |
-
|
| 441 |
-
$customerBluestore = $appBaseDir."/customer_bluestore_response.xml";
|
| 442 |
-
$fcustomer = fopen($customerBluestore, 'w+');
|
| 443 |
-
fwrite($fcustomer, $response);
|
| 444 |
-
fclose($fcustomer);
|
| 445 |
-
|
| 446 |
-
$xmlObj = new Varien_Simplexml_Config($response);
|
| 447 |
-
$xmlData = $xmlObj->getNode();
|
| 448 |
|
| 449 |
-
$
|
| 450 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 451 |
-
|
| 452 |
-
$ResposeData = $xmlData->transactionsBatch;
|
| 453 |
-
|
| 454 |
-
$countSuccess = 0;
|
| 455 |
-
foreach($ResposeData as $row)
|
| 456 |
{
|
| 457 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
{
|
| 459 |
-
$
|
| 460 |
-
$
|
| 461 |
-
|
| 462 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 463 |
}
|
|
|
|
|
|
|
| 464 |
else
|
| 465 |
-
|
| 466 |
-
$ErrorMsg .= $row->transaction->message.":";
|
| 467 |
-
}
|
| 468 |
}
|
| 469 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
{
|
| 471 |
-
$
|
| 472 |
-
$
|
| 473 |
|
| 474 |
-
$
|
| 475 |
-
$
|
| 476 |
-
|
| 477 |
-
|
|
|
|
| 478 |
{
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
else
|
| 482 |
-
$ErrorMsg = str_ireplace("'",'',$ErrorMsg);
|
| 483 |
-
|
| 484 |
-
$cronStatus = ($countSuccess > 0)?'success':'error';
|
| 485 |
|
| 486 |
-
$
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 494 |
|
| 495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 496 |
}
|
| 497 |
-
}
|
| 498 |
}
|
| 499 |
|
| 500 |
#### Function For Getting Data From Bluestore
|
|
@@ -575,6 +743,9 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 575 |
$fh = fopen($permFile, 'w');
|
| 576 |
fwrite($fh, $credentials['mycustom_certificate']);
|
| 577 |
fclose($fh);
|
|
|
|
|
|
|
|
|
|
| 578 |
|
| 579 |
if(!file_exists($permFile))
|
| 580 |
{
|
|
@@ -611,25 +782,129 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 611 |
curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Accept: application/xml"));
|
| 612 |
$response = curl_exec($tuCurl);
|
| 613 |
$response1 = curl_getinfo( $tuCurl );
|
|
|
|
|
|
|
| 614 |
return $response;
|
| 615 |
}
|
| 616 |
else
|
| 617 |
{
|
| 618 |
-
$
|
| 619 |
-
$
|
| 620 |
-
|
| 621 |
-
$
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 633 |
return $response;
|
| 634 |
}
|
| 635 |
}
|
|
@@ -655,20 +930,16 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 655 |
}
|
| 656 |
else
|
| 657 |
{
|
| 658 |
-
$extraStoreCode
|
| 659 |
-
|
| 660 |
-
$
|
| 661 |
-
$
|
| 662 |
-
|
| 663 |
-
$resultCoreConfig = $connection->query("select value from ".$prefix."core_config_data where path = 'mycustom_section/mycustom_stock_group/mycustom_currentstockversion'");
|
| 664 |
-
$resultSetCoreConfig = $resultCoreConfig->fetchAll(PDO::FETCH_ASSOC);
|
| 665 |
|
| 666 |
-
$
|
| 667 |
-
|
| 668 |
-
$CoreConfigValue = $resultSetCoreConfig[0]['value'];
|
| 669 |
else
|
| 670 |
$CoreConfigValue = '0';
|
| 671 |
-
|
| 672 |
$mainVersionVal = ($CoreConfigValue == '0' || $CoreConfigValue == '')?'-1':$CoreConfigValue;
|
| 673 |
|
| 674 |
if(isset($extraStoreCode) && !empty($extraStoreCode))
|
|
@@ -739,6 +1010,16 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 739 |
{
|
| 740 |
$extra = $extraCode;
|
| 741 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 742 |
if(isset($extra) && !empty($extra))
|
| 743 |
{
|
| 744 |
$array=array();
|
|
@@ -763,11 +1044,15 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 763 |
}
|
| 764 |
else
|
| 765 |
{
|
| 766 |
-
$
|
|
|
|
|
|
|
|
|
|
| 767 |
$auth_query = _build_http_query($auth);
|
| 768 |
$auth_query = $baseurl."?".$auth_query;
|
|
|
|
| 769 |
$tuCurl = curl_init();
|
| 770 |
-
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 771 |
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 772 |
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 773 |
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
|
@@ -804,7 +1089,7 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 804 |
{
|
| 805 |
$extra = $extraCode;
|
| 806 |
$stock_credentials = Mage::getStoreConfig('mycustom_section/mycustom_stock_group');
|
| 807 |
-
$sale_credentials = Mage::getStoreConfig('mycustom_section/
|
| 808 |
|
| 809 |
$extraStoreCode = $stock_credentials['mycustom_bluestorecode'];
|
| 810 |
$endDateTimeSpace = explode(" ",$sale_credentials['mycustom_bluestore_enddatetime']);
|
|
@@ -1091,7 +1376,6 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 1091 |
}
|
| 1092 |
else
|
| 1093 |
{
|
| 1094 |
-
$toXml1 = $this->xmlAction1($response);
|
| 1095 |
switch($this->flag)
|
| 1096 |
{
|
| 1097 |
case 3:
|
|
@@ -1684,7 +1968,7 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 1684 |
}
|
| 1685 |
break;
|
| 1686 |
}
|
| 1687 |
-
else if($response
|
| 1688 |
{
|
| 1689 |
$message = $this->__('There was a problem calling the Bluestore API. The data could not be exported. Please contact your site administrator.');
|
| 1690 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
|
@@ -1698,6 +1982,20 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 1698 |
}
|
| 1699 |
break;
|
| 1700 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1701 |
else
|
| 1702 |
{
|
| 1703 |
Mage::log('The Private Certificate is created', null, './Bluestore_customer_post.log.text');
|
|
@@ -1722,7 +2020,7 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 1722 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 1723 |
}
|
| 1724 |
break;
|
| 1725 |
-
case 8: #### This case handles the
|
| 1726 |
try
|
| 1727 |
{
|
| 1728 |
$response = $this->parseAction('saleimport',$transactioncode);
|
|
@@ -1770,7 +2068,7 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 1770 |
else
|
| 1771 |
{
|
| 1772 |
|
| 1773 |
-
$toXml1 = $this->xmlActionSale($response);
|
| 1774 |
|
| 1775 |
switch($this->flag)
|
| 1776 |
{
|
|
@@ -1822,7 +2120,7 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 1822 |
|
| 1823 |
case 6:
|
| 1824 |
$this->flag = 0;
|
| 1825 |
-
$message = $this->__('All of
|
| 1826 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 1827 |
Mage::log('The Private Certificate is created', null, './Bluestore_sales_import.log.text');
|
| 1828 |
Mage::log('The Private Certificate is populated', null, './Bluestore_sales_import.log.text');
|
|
@@ -1880,6 +2178,117 @@ class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Cont
|
|
| 1880 |
{
|
| 1881 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 1882 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1883 |
break;
|
| 1884 |
|
| 1885 |
}
|
| 11 |
class Bluefish_Connection_Adminhtml_MyformController extends Mage_Adminhtml_Controller_Action
|
| 12 |
{
|
| 13 |
public static $flag = 0;
|
| 14 |
+
#### Bluestore Live/QA Path For GET and POST Data
|
| 15 |
+
const CATEGORY = 'https://bluestorelive.com:9001/rest/category/';
|
| 16 |
+
const PRODUCT = 'https://bluestorelive.com:9001/rest/product/';
|
| 17 |
+
const STOCK = 'https://bluestorelive.com:9001/rest/stock/';
|
| 18 |
const CUSTOMER = 'https://bluestorelive.com:9001/rest/customer/';
|
| 19 |
+
const ORDERPOST = 'https://bluestorelive.com:9001/rest/inbound/';
|
| 20 |
const CUSTOMERPOST = 'https://bluestorelive.com:9001/rest/inbound/';
|
| 21 |
+
const SALEIMPORT = 'https://bluestorelive.com:9001/rest/sale/';
|
| 22 |
+
const PRODUCTPOST = "https://bluestorelive.com:9001/rest/inbound/";
|
| 23 |
|
| 24 |
+
public function indexAction()
|
| 25 |
+
{
|
| 26 |
+
$this->loadLayout()->renderLayout();
|
| 27 |
+
}
|
| 28 |
|
| 29 |
### Function For Write Bluestore Category Data into categories_bluefish.xml File
|
| 30 |
public function xmlAction($response)
|
| 225 |
}
|
| 226 |
|
| 227 |
### Function For Write Bluestore Sale Data into sales_bluestore.xml File
|
| 228 |
+
public function xmlActionSale($response,$transactioncode)
|
| 229 |
{
|
| 230 |
$appBaseDir = Mage::getBaseDir();
|
| 231 |
$xmlFiles = $appBaseDir."/sales_bluestore_import.xml";
|
| 255 |
}
|
| 256 |
else
|
| 257 |
{
|
| 258 |
+
$result_database = importBluestoreSales($transactioncode);
|
| 259 |
if($result_database == "fail")
|
| 260 |
{
|
| 261 |
$this->flag=6;
|
| 408 |
else
|
| 409 |
{
|
| 410 |
$custRdata = $appBaseDir."/customer_bluestore_request.xml";
|
| 411 |
+
$cfrequest = fopen($custRdata, 'w+');
|
| 412 |
+
ob_start();
|
| 413 |
+
echo "<pre>";
|
| 414 |
+
print_r($xml);
|
| 415 |
+
$previousdata =ob_get_contents();
|
| 416 |
+
ob_clean();
|
| 417 |
|
| 418 |
+
fwrite($cfrequest, $previousdata);
|
| 419 |
+
fclose($cfrequest);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
+
if(count($xml) > 0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
{
|
| 423 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 424 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 425 |
+
|
| 426 |
+
$chunksize = 100;
|
| 427 |
+
$finalData= array_chunk($xml,$chunksize);
|
| 428 |
+
$enterprise_code = '';
|
| 429 |
+
|
| 430 |
+
foreach($finalData as $datas)
|
| 431 |
{
|
| 432 |
+
$custXmlData = "";
|
| 433 |
+
$finalstring = implode("",$datas);
|
| 434 |
+
|
| 435 |
+
$custXmlData = "<?xml version=\"1.0\"?>
|
| 436 |
+
<inbound lang=\"en\" enterprise=\"".$enterprise_code."\" requestNo=\"1\">".$finalstring."</inbound>";
|
| 437 |
+
|
| 438 |
+
$auth = build_auth_array($baseurl, $credentials['mycustom_code'],$permFile,'','POST');
|
| 439 |
+
$auth2 = build_auth_string($auth);
|
| 440 |
+
|
| 441 |
+
$auth_query = $baseurl;
|
| 442 |
+
|
| 443 |
+
$header = array(
|
| 444 |
+
'Accept: application/xml',
|
| 445 |
+
'Content-Type: application/xml',
|
| 446 |
+
'Expect:'
|
| 447 |
+
);
|
| 448 |
+
$header = array_merge($auth2,$header);
|
| 449 |
+
|
| 450 |
+
$tuCurl = curl_init();
|
| 451 |
+
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 452 |
+
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 453 |
+
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 454 |
+
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 455 |
+
curl_setopt($tuCurl, CURLOPT_POST, 1);
|
| 456 |
+
curl_setopt($tuCurl, CURLOPT_TIMEOUT, 0);
|
| 457 |
+
curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $custXmlData);
|
| 458 |
+
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, false);
|
| 459 |
+
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
|
| 460 |
+
curl_setopt($tuCurl, CURLOPT_FOLLOWLOCATION, 1);
|
| 461 |
+
curl_setopt($tuCurl, CURLINFO_HEADER_OUT, TRUE);
|
| 462 |
+
curl_setopt($tuCurl, CURLOPT_HTTPHEADER,$header);
|
| 463 |
+
$response = curl_exec($tuCurl);
|
| 464 |
+
$response1 = curl_getinfo( $tuCurl );
|
| 465 |
+
|
| 466 |
+
if($response1['http_code'] == "200")
|
| 467 |
+
{
|
| 468 |
+
$customerBluestore = $appBaseDir."/customer_bluestore_response.xml";
|
| 469 |
+
$fcustomer = fopen($customerBluestore, 'w+');
|
| 470 |
+
fwrite($fcustomer, $response);
|
| 471 |
+
fclose($fcustomer);
|
| 472 |
+
|
| 473 |
+
$xmlObj = new Varien_Simplexml_Config($response);
|
| 474 |
+
$xmlData = $xmlObj->getNode();
|
| 475 |
+
|
| 476 |
+
$responseCode = $xmlData->transactionsBatch->batchSuccess;
|
| 477 |
+
$ResposeData = $xmlData->transactionsBatch;
|
| 478 |
+
|
| 479 |
+
$countSuccess = 0;
|
| 480 |
+
foreach($ResposeData as $row)
|
| 481 |
+
{
|
| 482 |
+
if($row->batchSuccess == "true")
|
| 483 |
+
{
|
| 484 |
+
$code = strval($row->transaction['docNo']);
|
| 485 |
+
$bluestoreRef = $row->transaction->bluestoreRef;
|
| 486 |
+
$CustomerUpdate = $connection->query("UPDATE ".$prefix."bluefish_customer SET customer_code= '".$bluestoreRef."' where customer_id = '".$code."'");
|
| 487 |
+
$countSuccess++;
|
| 488 |
+
}
|
| 489 |
+
else
|
| 490 |
+
{
|
| 491 |
+
$ErrorMsg .= $row->transaction->message.":";
|
| 492 |
+
}
|
| 493 |
+
}
|
| 494 |
+
if($ErrorMsg != "" || $xmlData->message !="")
|
| 495 |
+
{
|
| 496 |
+
$resultCronScheduleID = $connection->query("SELECT schedule_id FROM ".$prefix."cron_schedule WHERE job_code = 'bluefish_connection_customerexport' AND status = 'pending' ORDER BY schedule_id DESC LIMIT 1");
|
| 497 |
+
$resultSetScheduleID = $resultCronScheduleID->fetchAll(PDO::FETCH_OBJ);
|
| 498 |
+
|
| 499 |
+
$ScheduledID = $resultSetScheduleID[0]->schedule_id;
|
| 500 |
+
$numberRows = count($resultSetScheduleID);
|
| 501 |
+
|
| 502 |
+
if($numberRows > 0)
|
| 503 |
+
{
|
| 504 |
+
if($ErrorMsg == "")
|
| 505 |
+
$ErrorMsg = addslashes($xmlData->message);
|
| 506 |
+
else
|
| 507 |
+
$ErrorMsg = str_ireplace("'",'',$ErrorMsg);
|
| 508 |
+
|
| 509 |
+
$cronStatus = ($countSuccess > 0)?'success':'error';
|
| 510 |
+
|
| 511 |
+
$connection->query("INSERT INTO ".$prefix."bluefish_cron_schedule_logs(id,schedule_id,error)
|
| 512 |
+
VALUES('','".$ScheduledID."','".$ErrorMsg."')");
|
| 513 |
+
}
|
| 514 |
+
}
|
| 515 |
+
}
|
| 516 |
+
sleep(1);
|
| 517 |
}
|
| 518 |
+
if($countSuccess > 0)
|
| 519 |
+
$responseCode = "true";
|
| 520 |
else
|
| 521 |
+
$responseCode = "false";
|
|
|
|
|
|
|
| 522 |
}
|
| 523 |
+
else{
|
| 524 |
+
$responseCode = "blankdata";
|
| 525 |
+
}
|
| 526 |
+
|
| 527 |
+
return $responseCode;
|
| 528 |
+
}
|
| 529 |
+
}
|
| 530 |
+
elseif($val == 'productexport') ### Condition for check the product export data
|
| 531 |
+
{
|
| 532 |
+
$baseurl = Bluefish_Connection_Adminhtml_MyformController::PRODUCTPOST;
|
| 533 |
+
$appBaseDir = Mage::getBaseDir();
|
| 534 |
+
$permFile = $appBaseDir."/bluefish_privatekey.PEM";
|
| 535 |
+
$fh = fopen($permFile, 'w+');
|
| 536 |
+
fwrite($fh, $credentials['mycustom_certificate']);
|
| 537 |
+
fclose($fh);
|
| 538 |
+
if(!file_exists($permFile))
|
| 539 |
+
{
|
| 540 |
+
$this->flag=1;
|
| 541 |
+
return;
|
| 542 |
+
}
|
| 543 |
+
else if(!filesize($permFile) > 0)
|
| 544 |
+
{
|
| 545 |
+
$this->flag=2;
|
| 546 |
+
return;
|
| 547 |
+
}
|
| 548 |
+
else
|
| 549 |
+
{
|
| 550 |
+
$productRdata = $appBaseDir."/product_export_request.xml";
|
| 551 |
+
$pfrequest = fopen($productRdata, 'w+');
|
| 552 |
+
ob_start();
|
| 553 |
+
echo "<pre>";
|
| 554 |
+
print_r($xml);
|
| 555 |
+
$previousdata =ob_get_contents();
|
| 556 |
+
ob_clean();
|
| 557 |
+
|
| 558 |
+
fwrite($pfrequest, $previousdata);
|
| 559 |
+
fclose($pfrequest);
|
| 560 |
+
|
| 561 |
+
if(count($xml) > 0)
|
| 562 |
{
|
| 563 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 564 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 565 |
|
| 566 |
+
$chunksize = 100;
|
| 567 |
+
$finalData= array_chunk($xml,$chunksize);
|
| 568 |
+
$enterprise_code = '';
|
| 569 |
+
|
| 570 |
+
foreach($finalData as $datas)
|
| 571 |
{
|
| 572 |
+
$productXmlData = "";
|
| 573 |
+
$finalstring = implode("",$datas);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 574 |
|
| 575 |
+
$productXmlData = "<?xml version=\"1.0\"?>
|
| 576 |
+
<inbound lang=\"en\" enterprise=\"".$enterprise_code."\" requestNo=\"1\">".$finalstring."</inbound>";
|
| 577 |
+
|
| 578 |
+
$auth = build_auth_array($baseurl, $credentials['mycustom_code'],$permFile,'','POST');
|
| 579 |
+
$auth2 = build_auth_string($auth);
|
| 580 |
+
|
| 581 |
+
$auth_query = $baseurl;
|
| 582 |
+
|
| 583 |
+
$header = array(
|
| 584 |
+
'Accept: application/xml',
|
| 585 |
+
'Content-Type: application/xml',
|
| 586 |
+
'Expect:'
|
| 587 |
+
);
|
| 588 |
+
$header = array_merge($auth2,$header);
|
| 589 |
+
|
| 590 |
+
$tuCurl = curl_init();
|
| 591 |
+
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 592 |
+
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 593 |
+
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 594 |
+
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 595 |
+
curl_setopt($tuCurl, CURLOPT_POST, 1);
|
| 596 |
+
curl_setopt($tuCurl, CURLOPT_TIMEOUT, 0);
|
| 597 |
+
curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $productXmlData);
|
| 598 |
+
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, false);
|
| 599 |
+
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
|
| 600 |
+
curl_setopt($tuCurl, CURLOPT_FOLLOWLOCATION, 1);
|
| 601 |
+
curl_setopt($tuCurl, CURLINFO_HEADER_OUT, TRUE);
|
| 602 |
+
curl_setopt($tuCurl, CURLOPT_HTTPHEADER,$header);
|
| 603 |
+
$response = curl_exec($tuCurl);
|
| 604 |
+
$response1 = curl_getinfo( $tuCurl );
|
| 605 |
|
| 606 |
+
if($response1['http_code'] == "200")
|
| 607 |
+
{
|
| 608 |
+
$customerBluestore = $appBaseDir."/product_export_response.xml";
|
| 609 |
+
$fcustomer = fopen($customerBluestore, 'w+');
|
| 610 |
+
fwrite($fcustomer, $response);
|
| 611 |
+
fclose($fcustomer);
|
| 612 |
+
|
| 613 |
+
$xmlObj = new Varien_Simplexml_Config($response);
|
| 614 |
+
$xmlData = $xmlObj->getNode();
|
| 615 |
+
|
| 616 |
+
$responseCode = $xmlData->transactionsBatch->batchSuccess;
|
| 617 |
+
$ResposeData = $xmlData->transactionsBatch;
|
| 618 |
+
|
| 619 |
+
$countSuccess = 0;
|
| 620 |
+
foreach($ResposeData as $row)
|
| 621 |
+
{
|
| 622 |
+
if($row->batchSuccess == "true")
|
| 623 |
+
{
|
| 624 |
+
$countSuccess++;
|
| 625 |
+
}
|
| 626 |
+
else
|
| 627 |
+
{
|
| 628 |
+
$ErrorMsg .= $row->transaction->message.":";
|
| 629 |
+
}
|
| 630 |
+
}
|
| 631 |
+
if($ErrorMsg != "" || $xmlData->message !="")
|
| 632 |
+
{
|
| 633 |
+
$resultCronScheduleID = $connection->query("SELECT schedule_id FROM ".$prefix."cron_schedule WHERE job_code = 'bluefish_connection_productexport' AND status = 'pending' ORDER BY schedule_id DESC LIMIT 1");
|
| 634 |
+
$resultSetScheduleID = $resultCronScheduleID->fetchAll(PDO::FETCH_OBJ);
|
| 635 |
+
|
| 636 |
+
$ScheduledID = $resultSetScheduleID[0]->schedule_id;
|
| 637 |
+
$numberRows = count($resultSetScheduleID);
|
| 638 |
+
|
| 639 |
+
if($numberRows > 0)
|
| 640 |
+
{
|
| 641 |
+
if($ErrorMsg == "")
|
| 642 |
+
$ErrorMsg = addslashes($xmlData->message);
|
| 643 |
+
else
|
| 644 |
+
$ErrorMsg = str_ireplace("'",'',$ErrorMsg);
|
| 645 |
+
|
| 646 |
+
$cronStatus = ($countSuccess > 0)?'success':'error';
|
| 647 |
+
|
| 648 |
+
$connection->query("INSERT INTO ".$prefix."bluefish_cron_schedule_logs(id,schedule_id,error)
|
| 649 |
+
VALUES('','".$ScheduledID."','".$ErrorMsg."')");
|
| 650 |
+
}
|
| 651 |
+
}
|
| 652 |
+
}
|
| 653 |
+
sleep(1);
|
| 654 |
+
}
|
| 655 |
+
if($countSuccess > 0)
|
| 656 |
+
$responseCode = "true";
|
| 657 |
+
else
|
| 658 |
+
$responseCode = "false";
|
| 659 |
+
}
|
| 660 |
+
else{
|
| 661 |
+
$responseCode = "blankdata";
|
| 662 |
+
}
|
| 663 |
+
return $responseCode;
|
| 664 |
}
|
| 665 |
+
}
|
| 666 |
}
|
| 667 |
|
| 668 |
#### Function For Getting Data From Bluestore
|
| 743 |
$fh = fopen($permFile, 'w');
|
| 744 |
fwrite($fh, $credentials['mycustom_certificate']);
|
| 745 |
fclose($fh);
|
| 746 |
+
|
| 747 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 748 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 749 |
|
| 750 |
if(!file_exists($permFile))
|
| 751 |
{
|
| 782 |
curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Accept: application/xml"));
|
| 783 |
$response = curl_exec($tuCurl);
|
| 784 |
$response1 = curl_getinfo( $tuCurl );
|
| 785 |
+
|
| 786 |
+
$responseValue = $this->xmlAction1($response);
|
| 787 |
return $response;
|
| 788 |
}
|
| 789 |
else
|
| 790 |
{
|
| 791 |
+
$credentialsProductc = Mage::getStoreConfig('mycustom_section/mycustom_product_group');
|
| 792 |
+
$productCurrentVersion = $credentialsProductc['mycustom_currentproductversion'];
|
| 793 |
+
|
| 794 |
+
if($productCurrentVersion > 0)
|
| 795 |
+
$CoreConfigValue = $productCurrentVersion;
|
| 796 |
+
else
|
| 797 |
+
$CoreConfigValue = '0';
|
| 798 |
+
|
| 799 |
+
$mainVersionVal = ($CoreConfigValue == '0' || $CoreConfigValue == '')?'0':$CoreConfigValue;
|
| 800 |
+
|
| 801 |
+
$updatesversionVal = array();
|
| 802 |
+
|
| 803 |
+
if($mainVersionVal == '0')
|
| 804 |
+
{
|
| 805 |
+
$resultCategory = $connection->query("select code from ".$prefix."bluefish_category");
|
| 806 |
+
$resultCategoryData = $resultCategory->fetchAll(PDO::FETCH_ASSOC);
|
| 807 |
+
$categoryCodeValue = "";
|
| 808 |
+
|
| 809 |
+
foreach($resultCategoryData as $catcodeVal)
|
| 810 |
+
{
|
| 811 |
+
$categoryCodeValue = $catcodeVal['code'];
|
| 812 |
+
$responseValue = "";
|
| 813 |
+
|
| 814 |
+
$array=array();
|
| 815 |
+
|
| 816 |
+
if($mainVersionVal == '0')
|
| 817 |
+
{
|
| 818 |
+
$array=array('where'=>rawurlencode('categoryCode = '.$categoryCodeValue.''));
|
| 819 |
+
}
|
| 820 |
+
else
|
| 821 |
+
{
|
| 822 |
+
$array=array('where'=>rawurlencode('version > '.$mainVersionVal.''));
|
| 823 |
+
}
|
| 824 |
+
|
| 825 |
+
$auth = build_auth_array($baseurl, $credentials['mycustom_code'],$permFile,$array);
|
| 826 |
+
|
| 827 |
+
$auth_query = _build_http_query($auth);
|
| 828 |
+
$auth_query = $baseurl."?".$auth_query;
|
| 829 |
+
|
| 830 |
+
$tuCurl = curl_init();
|
| 831 |
+
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 832 |
+
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 833 |
+
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 834 |
+
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 835 |
+
curl_setopt($tuCurl, CURLOPT_HTTPGET, 1);
|
| 836 |
+
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, false);
|
| 837 |
+
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
|
| 838 |
+
curl_setopt($tuCurl, CURLOPT_FOLLOWLOCATION, 1);
|
| 839 |
+
curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Accept: application/xml"));
|
| 840 |
+
$response = curl_exec($tuCurl);
|
| 841 |
+
$response1 = curl_getinfo( $tuCurl );
|
| 842 |
+
|
| 843 |
+
if($response != "")
|
| 844 |
+
{
|
| 845 |
+
$xmlObj = new Varien_Simplexml_Config($response);
|
| 846 |
+
$xmlData = $xmlObj->getNode();
|
| 847 |
+
|
| 848 |
+
if(count($xmlData) > 0)
|
| 849 |
+
{
|
| 850 |
+
for($i=0;$i<count($xmlData);$i++)
|
| 851 |
+
{
|
| 852 |
+
$versionVal = $xmlData->product[$i]->version;
|
| 853 |
+
$updatesversionVal[] = "$versionVal";
|
| 854 |
+
}
|
| 855 |
+
}
|
| 856 |
+
|
| 857 |
+
$responseValue = $this->xmlAction1($response);
|
| 858 |
+
}
|
| 859 |
+
}
|
| 860 |
+
}
|
| 861 |
+
else
|
| 862 |
+
{
|
| 863 |
+
$array=array('where'=>rawurlencode('version > '.$mainVersionVal.''));
|
| 864 |
+
$auth = build_auth_array($baseurl, $credentials['mycustom_code'],$permFile,$array);
|
| 865 |
+
|
| 866 |
+
$auth_query = _build_http_query($auth);
|
| 867 |
+
$auth_query = $baseurl."?".$auth_query;
|
| 868 |
+
|
| 869 |
+
$tuCurl = curl_init();
|
| 870 |
+
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 871 |
+
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 872 |
+
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 873 |
+
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 874 |
+
curl_setopt($tuCurl, CURLOPT_HTTPGET, 1);
|
| 875 |
+
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, false);
|
| 876 |
+
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
|
| 877 |
+
curl_setopt($tuCurl, CURLOPT_FOLLOWLOCATION, 1);
|
| 878 |
+
curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Accept: application/xml"));
|
| 879 |
+
$response = curl_exec($tuCurl);
|
| 880 |
+
$response1 = curl_getinfo( $tuCurl );
|
| 881 |
+
|
| 882 |
+
if($response != "")
|
| 883 |
+
{
|
| 884 |
+
$xmlObj = new Varien_Simplexml_Config($response);
|
| 885 |
+
$xmlData = $xmlObj->getNode();
|
| 886 |
+
|
| 887 |
+
if(count($xmlData) > 0)
|
| 888 |
+
{
|
| 889 |
+
for($i=0;$i<count($xmlData);$i++)
|
| 890 |
+
{
|
| 891 |
+
$versionVal = $xmlData->product[$i]->version;
|
| 892 |
+
$updatesversionVal[] = "$versionVal";
|
| 893 |
+
}
|
| 894 |
+
}
|
| 895 |
+
|
| 896 |
+
$responseValue = $this->xmlAction1($response);
|
| 897 |
+
}
|
| 898 |
+
|
| 899 |
+
|
| 900 |
+
}
|
| 901 |
+
|
| 902 |
+
if(count($updatesversionVal) > 0)
|
| 903 |
+
{
|
| 904 |
+
$versionValMax = max($updatesversionVal);
|
| 905 |
+
Mage::getModel('core/config')->saveConfig('mycustom_section/mycustom_product_group/mycustom_currentproductversion', $versionValMax);
|
| 906 |
+
}
|
| 907 |
+
|
| 908 |
return $response;
|
| 909 |
}
|
| 910 |
}
|
| 930 |
}
|
| 931 |
else
|
| 932 |
{
|
| 933 |
+
$extraStoreCode = $stock_credentials['mycustom_bluestorecode'];
|
| 934 |
+
|
| 935 |
+
$credentialsStock = Mage::getStoreConfig('mycustom_section/mycustom_stock_group');
|
| 936 |
+
$stockCurrentVersion = $credentialsStock['mycustom_currentstockversion'];
|
|
|
|
|
|
|
|
|
|
| 937 |
|
| 938 |
+
if($stockCurrentVersion > 0)
|
| 939 |
+
$CoreConfigValue = $stockCurrentVersion;
|
|
|
|
| 940 |
else
|
| 941 |
$CoreConfigValue = '0';
|
| 942 |
+
|
| 943 |
$mainVersionVal = ($CoreConfigValue == '0' || $CoreConfigValue == '')?'-1':$CoreConfigValue;
|
| 944 |
|
| 945 |
if(isset($extraStoreCode) && !empty($extraStoreCode))
|
| 1010 |
{
|
| 1011 |
$extra = $extraCode;
|
| 1012 |
|
| 1013 |
+
$credentialsCustomer = Mage::getStoreConfig('mycustom_section/mycustom_customer_group');
|
| 1014 |
+
$customerCurrentVersion = $credentialsCustomer['mycustom_bluestore_customer_version'];
|
| 1015 |
+
|
| 1016 |
+
if($customerCurrentVersion > 0)
|
| 1017 |
+
$CoreConfigValue = $customerCurrentVersion;
|
| 1018 |
+
else
|
| 1019 |
+
$CoreConfigValue = '0';
|
| 1020 |
+
|
| 1021 |
+
$mainVersionVal = ($CoreConfigValue == '0' || $CoreConfigValue == '')?'0':$CoreConfigValue;
|
| 1022 |
+
|
| 1023 |
if(isset($extra) && !empty($extra))
|
| 1024 |
{
|
| 1025 |
$array=array();
|
| 1044 |
}
|
| 1045 |
else
|
| 1046 |
{
|
| 1047 |
+
$array=array();
|
| 1048 |
+
$array=array('where'=>rawurlencode('version > '.$mainVersionVal.''));
|
| 1049 |
+
$auth = build_auth_array($baseurl, $credentials['mycustom_code'],$permFile,$array);
|
| 1050 |
+
|
| 1051 |
$auth_query = _build_http_query($auth);
|
| 1052 |
$auth_query = $baseurl."?".$auth_query;
|
| 1053 |
+
|
| 1054 |
$tuCurl = curl_init();
|
| 1055 |
+
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 1056 |
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 1057 |
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 1058 |
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 1089 |
{
|
| 1090 |
$extra = $extraCode;
|
| 1091 |
$stock_credentials = Mage::getStoreConfig('mycustom_section/mycustom_stock_group');
|
| 1092 |
+
$sale_credentials = Mage::getStoreConfig('mycustom_section/mycustom_sales_import_group');
|
| 1093 |
|
| 1094 |
$extraStoreCode = $stock_credentials['mycustom_bluestorecode'];
|
| 1095 |
$endDateTimeSpace = explode(" ",$sale_credentials['mycustom_bluestore_enddatetime']);
|
| 1376 |
}
|
| 1377 |
else
|
| 1378 |
{
|
|
|
|
| 1379 |
switch($this->flag)
|
| 1380 |
{
|
| 1381 |
case 3:
|
| 1968 |
}
|
| 1969 |
break;
|
| 1970 |
}
|
| 1971 |
+
else if($response == 'false')
|
| 1972 |
{
|
| 1973 |
$message = $this->__('There was a problem calling the Bluestore API. The data could not be exported. Please contact your site administrator.');
|
| 1974 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 1982 |
}
|
| 1983 |
break;
|
| 1984 |
}
|
| 1985 |
+
else if($response == 'blankdata')
|
| 1986 |
+
{
|
| 1987 |
+
$message = $this->__('There is no more customer record for export according to condition.');
|
| 1988 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
| 1989 |
+
Mage::log('The Private Certificate is created', null, './Bluestore_customer_post.log.text');
|
| 1990 |
+
Mage::log('The Private Certificate is populated', null, './Bluestore_customer_post.log.text');
|
| 1991 |
+
Mage::log('There is no more customer record for export according to condition', null, './Bluestore_customer_post.log.text');
|
| 1992 |
+
if(!$value_cron)
|
| 1993 |
+
{
|
| 1994 |
+
$this->_redirect('*/*');
|
| 1995 |
+
break;
|
| 1996 |
+
}
|
| 1997 |
+
break;
|
| 1998 |
+
}
|
| 1999 |
else
|
| 2000 |
{
|
| 2001 |
Mage::log('The Private Certificate is created', null, './Bluestore_customer_post.log.text');
|
| 2020 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 2021 |
}
|
| 2022 |
break;
|
| 2023 |
+
case 8: #### This case handles the sale data
|
| 2024 |
try
|
| 2025 |
{
|
| 2026 |
$response = $this->parseAction('saleimport',$transactioncode);
|
| 2068 |
else
|
| 2069 |
{
|
| 2070 |
|
| 2071 |
+
$toXml1 = $this->xmlActionSale($response,$transactioncode);
|
| 2072 |
|
| 2073 |
switch($this->flag)
|
| 2074 |
{
|
| 2120 |
|
| 2121 |
case 6:
|
| 2122 |
$this->flag = 0;
|
| 2123 |
+
$message = $this->__('All of the records have not imported correctly. Please check the sales import error logs.');
|
| 2124 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 2125 |
Mage::log('The Private Certificate is created', null, './Bluestore_sales_import.log.text');
|
| 2126 |
Mage::log('The Private Certificate is populated', null, './Bluestore_sales_import.log.text');
|
| 2178 |
{
|
| 2179 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 2180 |
}
|
| 2181 |
+
break;
|
| 2182 |
+
case 9:
|
| 2183 |
+
try
|
| 2184 |
+
{
|
| 2185 |
+
$exportedata = ExportProductData();
|
| 2186 |
+
|
| 2187 |
+
if($exportedata == 'fail')
|
| 2188 |
+
{
|
| 2189 |
+
$message = $this->__('There was a problem with the magento API while fetching data to export. Please contact your site administrator.');
|
| 2190 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 2191 |
+
Mage::log('Magento is unable to get the data.', null, './Bluestore_productexport.log.text');
|
| 2192 |
+
if(!$value_cron)
|
| 2193 |
+
{
|
| 2194 |
+
$this->_redirect('*/*');
|
| 2195 |
+
break;
|
| 2196 |
+
}
|
| 2197 |
+
break;
|
| 2198 |
+
}
|
| 2199 |
+
else if($exportedata == 'Exist')
|
| 2200 |
+
{
|
| 2201 |
+
$message = $this->__('There is no new product data to export.');
|
| 2202 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 2203 |
+
Mage::log('Product data already export.', null, './Bluestore_productexport.log.text');
|
| 2204 |
+
if(!$value_cron)
|
| 2205 |
+
{
|
| 2206 |
+
$this->_redirect('*/*');
|
| 2207 |
+
break;
|
| 2208 |
+
}
|
| 2209 |
+
break;
|
| 2210 |
+
}
|
| 2211 |
+
else
|
| 2212 |
+
{
|
| 2213 |
+
$response = $this->parseXMLForPost('productexport',$exportedata);
|
| 2214 |
+
if($this->flag == 1)
|
| 2215 |
+
{
|
| 2216 |
+
$this->flag = 0;
|
| 2217 |
+
$message = $this->__('There is a problem with the API authentication, the private key file could not be found. Please contact the site administrator.');
|
| 2218 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 2219 |
+
Mage::log('The Private Certificate cannot be created.', null, './Bluestore_productexport.log.text');
|
| 2220 |
+
if(!$value_cron)
|
| 2221 |
+
{
|
| 2222 |
+
$this->_redirect('*/*');
|
| 2223 |
+
break;
|
| 2224 |
+
}
|
| 2225 |
+
break;
|
| 2226 |
+
}
|
| 2227 |
+
else if($this->flag == 2)
|
| 2228 |
+
{
|
| 2229 |
+
$this->flag = 0;
|
| 2230 |
+
$message = $this->__('There is a problem with the API authentication, the private key file does not contain a valid certificate. Please contact the site administrator.');
|
| 2231 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 2232 |
+
Mage::log('The Private Certificate is created.', null, './Bluestore_productexport.log.text');
|
| 2233 |
+
Mage::log('The Private Certificate cannnot be populated.', null, './Bluestore_productexport.log.text');
|
| 2234 |
+
if(!$value_cron)
|
| 2235 |
+
{
|
| 2236 |
+
$this->_redirect('*/*');
|
| 2237 |
+
break;
|
| 2238 |
+
}
|
| 2239 |
+
break;
|
| 2240 |
+
}
|
| 2241 |
+
else if($response == 'false')
|
| 2242 |
+
{
|
| 2243 |
+
$message = $this->__('There was a problem calling the Bluestore API. The data could not be exported. Please contact your site administrator.');
|
| 2244 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 2245 |
+
Mage::log('The Private Certificate is created', null, './Bluestore_productexport.log.text');
|
| 2246 |
+
Mage::log('The Private Certificate is populated', null, './Bluestore_productexport.log.text');
|
| 2247 |
+
Mage::log('Product Export Failed, No Product Export', null, './Bluestore_productexport.log.text');
|
| 2248 |
+
if(!$value_cron)
|
| 2249 |
+
{
|
| 2250 |
+
$this->_redirect('*/*');
|
| 2251 |
+
break;
|
| 2252 |
+
}
|
| 2253 |
+
break;
|
| 2254 |
+
}
|
| 2255 |
+
else if($response == 'blankdata')
|
| 2256 |
+
{
|
| 2257 |
+
$message = $this->__('There is no more product record for export according to condition.');
|
| 2258 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
| 2259 |
+
Mage::log('The Private Certificate is created', null, './Bluestore_productexport.log.text');
|
| 2260 |
+
Mage::log('The Private Certificate is populated', null, './Bluestore_productexport.log.text');
|
| 2261 |
+
Mage::log('There is no more product record for export according to condition', null, './Bluestore_productexport.log.text');
|
| 2262 |
+
if(!$value_cron)
|
| 2263 |
+
{
|
| 2264 |
+
$this->_redirect('*/*');
|
| 2265 |
+
break;
|
| 2266 |
+
}
|
| 2267 |
+
break;
|
| 2268 |
+
}
|
| 2269 |
+
else
|
| 2270 |
+
{
|
| 2271 |
+
Mage::log('The Private Certificate is created', null, './Bluestore_productexport.log.text');
|
| 2272 |
+
Mage::log('The Private Certificate is populated', null, './Bluestore_productexport.log.text');
|
| 2273 |
+
Mage::log('The Product xml is populated.', null, './Bluestore_productexport.log.text');
|
| 2274 |
+
Mage::log('Product Export Finished Successfully.', null, './Bluestore_productexport.log.text');
|
| 2275 |
+
|
| 2276 |
+
if(!$value_cron)
|
| 2277 |
+
{
|
| 2278 |
+
$message = $this->__('Products have been successfully exported.');
|
| 2279 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
| 2280 |
+
$this->_redirect('*/*');
|
| 2281 |
+
break;
|
| 2282 |
+
}
|
| 2283 |
+
break;
|
| 2284 |
+
}
|
| 2285 |
+
}
|
| 2286 |
+
|
| 2287 |
+
}
|
| 2288 |
+
catch (Exception $e)
|
| 2289 |
+
{
|
| 2290 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 2291 |
+
}
|
| 2292 |
break;
|
| 2293 |
|
| 2294 |
}
|
app/code/local/Bluefish/Connection/controllers/Adminhtml/MyformexportController.php
CHANGED
|
@@ -10,8 +10,9 @@ include("Xml.php");
|
|
| 10 |
class Bluefish_Connection_Adminhtml_MyformexportController extends Mage_Adminhtml_Controller_Action
|
| 11 |
{
|
| 12 |
public static $flag = 0;
|
| 13 |
-
const ORDERPOST
|
| 14 |
const CUSTOMERPOST = "https://bluestorelive.com:9001/rest/inbound/";
|
|
|
|
| 15 |
|
| 16 |
public function indexAction()
|
| 17 |
{
|
|
@@ -127,60 +128,201 @@ class Bluefish_Connection_Adminhtml_MyformexportController extends Mage_Adminhtm
|
|
| 127 |
else
|
| 128 |
{
|
| 129 |
$custRdata = $appBaseDir."/customer_bluestore_request.xml";
|
| 130 |
-
$cfrequest
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
$
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
$auth_query = $baseurl;
|
| 138 |
|
| 139 |
-
$
|
| 140 |
-
|
| 141 |
-
'Content-Type: application/xml',
|
| 142 |
-
'Expect:'
|
| 143 |
-
);
|
| 144 |
-
$header = array_merge($auth2,$header);
|
| 145 |
-
|
| 146 |
-
$tuCurl = curl_init();
|
| 147 |
-
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 148 |
-
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 149 |
-
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 150 |
-
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 151 |
-
curl_setopt($tuCurl, CURLOPT_POST, 1);
|
| 152 |
-
curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $xml);
|
| 153 |
-
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, false);
|
| 154 |
-
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
|
| 155 |
-
curl_setopt($tuCurl, CURLOPT_FOLLOWLOCATION, 1);
|
| 156 |
-
curl_setopt($tuCurl, CURLINFO_HEADER_OUT, TRUE);
|
| 157 |
-
curl_setopt($tuCurl, CURLOPT_HTTPHEADER,$header);
|
| 158 |
-
$response = curl_exec($tuCurl);
|
| 159 |
-
$response1 = curl_getinfo( $tuCurl );
|
| 160 |
|
| 161 |
-
$
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
-
$
|
| 173 |
-
$
|
| 174 |
|
| 175 |
-
|
| 176 |
{
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
}
|
| 181 |
return $responseCode;
|
| 182 |
}
|
| 183 |
-
}
|
| 184 |
}
|
| 185 |
|
| 186 |
public function postAction($cron_value)
|
|
@@ -350,7 +492,7 @@ class Bluefish_Connection_Adminhtml_MyformexportController extends Mage_Adminhtm
|
|
| 350 |
}
|
| 351 |
break;
|
| 352 |
}
|
| 353 |
-
else if($response
|
| 354 |
{
|
| 355 |
$message = $this->__('There was a problem calling the Bluestore API. The data could not be exported. Please contact your site administrator.');
|
| 356 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
|
@@ -364,6 +506,20 @@ class Bluefish_Connection_Adminhtml_MyformexportController extends Mage_Adminhtm
|
|
| 364 |
}
|
| 365 |
break;
|
| 366 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 367 |
else
|
| 368 |
{
|
| 369 |
Mage::log('The Private Certificate is created', null, './Bluestore_customer_post.log.text');
|
|
@@ -388,6 +544,116 @@ class Bluefish_Connection_Adminhtml_MyformexportController extends Mage_Adminhtm
|
|
| 388 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 389 |
}
|
| 390 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
|
| 392 |
case 7: #### This case handles the category data export in csv
|
| 393 |
try
|
| 10 |
class Bluefish_Connection_Adminhtml_MyformexportController extends Mage_Adminhtml_Controller_Action
|
| 11 |
{
|
| 12 |
public static $flag = 0;
|
| 13 |
+
const ORDERPOST = "https://bluestorelive.com:9001/rest/inbound/";
|
| 14 |
const CUSTOMERPOST = "https://bluestorelive.com:9001/rest/inbound/";
|
| 15 |
+
const PRODUCTPOST = "https://bluestorelive.com:9001/rest/inbound/";
|
| 16 |
|
| 17 |
public function indexAction()
|
| 18 |
{
|
| 128 |
else
|
| 129 |
{
|
| 130 |
$custRdata = $appBaseDir."/customer_bluestore_request.xml";
|
| 131 |
+
$cfrequest = fopen($custRdata, 'w+');
|
| 132 |
+
ob_start();
|
| 133 |
+
echo "<pre>";
|
| 134 |
+
print_r($xml);
|
| 135 |
+
$previousdata =ob_get_contents();
|
| 136 |
+
ob_clean();
|
|
|
|
|
|
|
| 137 |
|
| 138 |
+
fwrite($cfrequest, $previousdata);
|
| 139 |
+
fclose($cfrequest);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
+
if(count($xml) > 0)
|
| 142 |
+
{
|
| 143 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 144 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 145 |
+
|
| 146 |
+
$chunksize = 100;
|
| 147 |
+
$finalData= array_chunk($xml,$chunksize);
|
| 148 |
+
$enterprise_code = '';
|
| 149 |
|
| 150 |
+
foreach($finalData as $datas)
|
| 151 |
+
{
|
| 152 |
+
$custXmlData = "";
|
| 153 |
+
$finalstring = implode("",$datas);
|
| 154 |
+
|
| 155 |
+
$custXmlData = "<?xml version=\"1.0\"?>
|
| 156 |
+
<inbound lang=\"en\" enterprise=\"".$enterprise_code."\" requestNo=\"1\">".$finalstring."</inbound>";
|
| 157 |
+
|
| 158 |
+
$auth = build_auth_array($baseurl, $credentials['mycustom_code'],$permFile,'','POST');
|
| 159 |
+
$auth2 = build_auth_string($auth);
|
| 160 |
+
|
| 161 |
+
$auth_query = $baseurl;
|
| 162 |
+
|
| 163 |
+
$header = array(
|
| 164 |
+
'Accept: application/xml',
|
| 165 |
+
'Content-Type: application/xml',
|
| 166 |
+
'Expect:'
|
| 167 |
+
);
|
| 168 |
+
$header = array_merge($auth2,$header);
|
| 169 |
+
|
| 170 |
+
$tuCurl = curl_init();
|
| 171 |
+
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 172 |
+
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 173 |
+
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 174 |
+
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 175 |
+
curl_setopt($tuCurl, CURLOPT_POST, 1);
|
| 176 |
+
curl_setopt($tuCurl, CURLOPT_TIMEOUT, 0);
|
| 177 |
+
curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $custXmlData);
|
| 178 |
+
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, false);
|
| 179 |
+
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
|
| 180 |
+
curl_setopt($tuCurl, CURLOPT_FOLLOWLOCATION, 1);
|
| 181 |
+
curl_setopt($tuCurl, CURLINFO_HEADER_OUT, TRUE);
|
| 182 |
+
curl_setopt($tuCurl, CURLOPT_HTTPHEADER,$header);
|
| 183 |
+
$response = curl_exec($tuCurl);
|
| 184 |
+
$response1 = curl_getinfo( $tuCurl );
|
| 185 |
+
|
| 186 |
+
if($response1['http_code'] == "200")
|
| 187 |
+
{
|
| 188 |
+
$customerBluestore = $appBaseDir."/customer_bluestore_response.xml";
|
| 189 |
+
$fcustomer = fopen($customerBluestore, 'w+');
|
| 190 |
+
fwrite($fcustomer, $response);
|
| 191 |
+
fclose($fcustomer);
|
| 192 |
+
|
| 193 |
+
$xmlObj = new Varien_Simplexml_Config($response);
|
| 194 |
+
$xmlData = $xmlObj->getNode();
|
| 195 |
+
|
| 196 |
+
$responseCode = $xmlData->transactionsBatch->batchSuccess;
|
| 197 |
+
$ResposeData = $xmlData->transactionsBatch;
|
| 198 |
+
|
| 199 |
+
foreach($ResposeData as $row)
|
| 200 |
+
{
|
| 201 |
+
$code = strval($row->transaction['docNo']);
|
| 202 |
+
$bluestoreRef = $row->transaction->bluestoreRef;
|
| 203 |
+
$CustomerUpdate = $connection->query("UPDATE ".$prefix."bluefish_customer SET customer_code= '".$bluestoreRef."' where customer_id = '".$code."'");
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
+
sleep(3);
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
else{
|
| 210 |
+
$responseCode = "blankdata";
|
| 211 |
+
}
|
| 212 |
+
return $responseCode;
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
elseif($val == 'productexport') ### Condition for check the product export data
|
| 216 |
+
{
|
| 217 |
+
$baseurl = Bluefish_Connection_Adminhtml_MyformexportController::PRODUCTPOST;
|
| 218 |
+
$appBaseDir = Mage::getBaseDir();
|
| 219 |
+
$permFile = $appBaseDir."/bluefish_privatekey.PEM";
|
| 220 |
+
$fh = fopen($permFile, 'w+');
|
| 221 |
+
fwrite($fh, $credentials['mycustom_certificate']);
|
| 222 |
+
fclose($fh);
|
| 223 |
+
if(!file_exists($permFile))
|
| 224 |
+
{
|
| 225 |
+
$this->flag=1;
|
| 226 |
+
return;
|
| 227 |
+
}
|
| 228 |
+
else if(!filesize($permFile) > 0)
|
| 229 |
+
{
|
| 230 |
+
$this->flag=2;
|
| 231 |
+
return;
|
| 232 |
+
}
|
| 233 |
+
else
|
| 234 |
+
{
|
| 235 |
+
$productRdata = $appBaseDir."/product_export_request.xml";
|
| 236 |
+
$pfrequest = fopen($productRdata, 'w+');
|
| 237 |
+
ob_start();
|
| 238 |
+
echo "<pre>";
|
| 239 |
+
print_r($xml);
|
| 240 |
+
$previousdata =ob_get_contents();
|
| 241 |
+
ob_clean();
|
| 242 |
|
| 243 |
+
fwrite($pfrequest, $previousdata);
|
| 244 |
+
fclose($pfrequest);
|
| 245 |
|
| 246 |
+
if(count($xml) > 0)
|
| 247 |
{
|
| 248 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 249 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 250 |
+
|
| 251 |
+
$chunksize = 100;
|
| 252 |
+
$finalData= array_chunk($xml,$chunksize);
|
| 253 |
+
$enterprise_code = '';
|
| 254 |
+
|
| 255 |
+
foreach($finalData as $datas)
|
| 256 |
+
{
|
| 257 |
+
$productXmlData = "";
|
| 258 |
+
$finalstring = implode("",$datas);
|
| 259 |
+
|
| 260 |
+
$productXmlData = "<?xml version=\"1.0\"?>
|
| 261 |
+
<inbound lang=\"en\" enterprise=\"".$enterprise_code."\" requestNo=\"1\">".$finalstring."</inbound>";
|
| 262 |
+
|
| 263 |
+
$auth = build_auth_array($baseurl, $credentials['mycustom_code'],$permFile,'','POST');
|
| 264 |
+
$auth2 = build_auth_string($auth);
|
| 265 |
+
|
| 266 |
+
$auth_query = $baseurl;
|
| 267 |
+
|
| 268 |
+
$header = array(
|
| 269 |
+
'Accept: application/xml',
|
| 270 |
+
'Content-Type: application/xml',
|
| 271 |
+
'Expect:'
|
| 272 |
+
);
|
| 273 |
+
$header = array_merge($auth2,$header);
|
| 274 |
+
|
| 275 |
+
$tuCurl = curl_init();
|
| 276 |
+
curl_setopt($tuCurl, CURLOPT_URL,$auth_query);
|
| 277 |
+
curl_setopt($tuCurl, CURLOPT_PORT , 9001);
|
| 278 |
+
curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
|
| 279 |
+
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
|
| 280 |
+
curl_setopt($tuCurl, CURLOPT_POST, 1);
|
| 281 |
+
curl_setopt($tuCurl, CURLOPT_TIMEOUT, 0);
|
| 282 |
+
curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $productXmlData);
|
| 283 |
+
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, false);
|
| 284 |
+
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
|
| 285 |
+
curl_setopt($tuCurl, CURLOPT_FOLLOWLOCATION, 1);
|
| 286 |
+
curl_setopt($tuCurl, CURLINFO_HEADER_OUT, TRUE);
|
| 287 |
+
curl_setopt($tuCurl, CURLOPT_HTTPHEADER,$header);
|
| 288 |
+
$response = curl_exec($tuCurl);
|
| 289 |
+
$response1 = curl_getinfo( $tuCurl );
|
| 290 |
+
|
| 291 |
+
if($response1['http_code'] == "200")
|
| 292 |
+
{
|
| 293 |
+
$customerBluestore = $appBaseDir."/product_export_response.xml";
|
| 294 |
+
$fcustomer = fopen($customerBluestore, 'w+');
|
| 295 |
+
fwrite($fcustomer, $response);
|
| 296 |
+
fclose($fcustomer);
|
| 297 |
+
|
| 298 |
+
$xmlObj = new Varien_Simplexml_Config($response);
|
| 299 |
+
$xmlData = $xmlObj->getNode();
|
| 300 |
+
|
| 301 |
+
$responseCode = $xmlData->transactionsBatch->batchSuccess;
|
| 302 |
+
$ResposeData = $xmlData->transactionsBatch;
|
| 303 |
+
|
| 304 |
+
$countSuccess = 0;
|
| 305 |
+
foreach($ResposeData as $row)
|
| 306 |
+
{
|
| 307 |
+
if($row->batchSuccess == "true")
|
| 308 |
+
{
|
| 309 |
+
$countSuccess++;
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
}
|
| 313 |
+
sleep(1);
|
| 314 |
+
}
|
| 315 |
+
if($countSuccess > 0)
|
| 316 |
+
$responseCode = "true";
|
| 317 |
+
else
|
| 318 |
+
$responseCode = "false";
|
| 319 |
+
}
|
| 320 |
+
else{
|
| 321 |
+
$responseCode = "blankdata";
|
| 322 |
}
|
| 323 |
return $responseCode;
|
| 324 |
}
|
| 325 |
+
}
|
| 326 |
}
|
| 327 |
|
| 328 |
public function postAction($cron_value)
|
| 492 |
}
|
| 493 |
break;
|
| 494 |
}
|
| 495 |
+
else if($response == 'false')
|
| 496 |
{
|
| 497 |
$message = $this->__('There was a problem calling the Bluestore API. The data could not be exported. Please contact your site administrator.');
|
| 498 |
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 506 |
}
|
| 507 |
break;
|
| 508 |
}
|
| 509 |
+
else if($response == 'blankdata')
|
| 510 |
+
{
|
| 511 |
+
$message = $this->__('There is no more customer record for export according to condition.');
|
| 512 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
| 513 |
+
Mage::log('The Private Certificate is created', null, './Bluestore_customer_post.log.text');
|
| 514 |
+
Mage::log('The Private Certificate is populated', null, './Bluestore_customer_post.log.text');
|
| 515 |
+
Mage::log('There is no more customer record for export according to condition', null, './Bluestore_customer_post.log.text');
|
| 516 |
+
if(!$value_cron)
|
| 517 |
+
{
|
| 518 |
+
$this->_redirect('*/*');
|
| 519 |
+
break;
|
| 520 |
+
}
|
| 521 |
+
break;
|
| 522 |
+
}
|
| 523 |
else
|
| 524 |
{
|
| 525 |
Mage::log('The Private Certificate is created', null, './Bluestore_customer_post.log.text');
|
| 544 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 545 |
}
|
| 546 |
break;
|
| 547 |
+
case 9:
|
| 548 |
+
try
|
| 549 |
+
{
|
| 550 |
+
$exportedata = ExportProductData();
|
| 551 |
+
if($exportedata == 'fail')
|
| 552 |
+
{
|
| 553 |
+
$message = $this->__('There was a problem with the magento API while fetching data to export. Please contact your site administrator.');
|
| 554 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 555 |
+
Mage::log('Magento is unable to get the data.', null, './Bluestore_productexport.log.text');
|
| 556 |
+
if(!$value_cron)
|
| 557 |
+
{
|
| 558 |
+
$this->_redirect('*/*');
|
| 559 |
+
break;
|
| 560 |
+
}
|
| 561 |
+
break;
|
| 562 |
+
}
|
| 563 |
+
else if($exportedata == 'Exist')
|
| 564 |
+
{
|
| 565 |
+
$message = $this->__('There is no new product data to export.');
|
| 566 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 567 |
+
Mage::log('Product data already export.', null, './Bluestore_productexport.log.text');
|
| 568 |
+
if(!$value_cron)
|
| 569 |
+
{
|
| 570 |
+
$this->_redirect('*/*');
|
| 571 |
+
break;
|
| 572 |
+
}
|
| 573 |
+
break;
|
| 574 |
+
}
|
| 575 |
+
else
|
| 576 |
+
{
|
| 577 |
+
$response = $this->parseXMLForPost('productexport',$exportedata);
|
| 578 |
+
if($this->flag == 1)
|
| 579 |
+
{
|
| 580 |
+
$this->flag = 0;
|
| 581 |
+
$message = $this->__('There is a problem with the API authentication, the private key file could not be found. Please contact the site administrator.');
|
| 582 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 583 |
+
Mage::log('The Private Certificate cannot be created.', null, './Bluestore_productexport.log.text');
|
| 584 |
+
if(!$value_cron)
|
| 585 |
+
{
|
| 586 |
+
$this->_redirect('*/*');
|
| 587 |
+
break;
|
| 588 |
+
}
|
| 589 |
+
break;
|
| 590 |
+
}
|
| 591 |
+
else if($this->flag == 2)
|
| 592 |
+
{
|
| 593 |
+
$this->flag = 0;
|
| 594 |
+
$message = $this->__('There is a problem with the API authentication, the private key file does not contain a valid certificate. Please contact the site administrator.');
|
| 595 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 596 |
+
Mage::log('The Private Certificate is created.', null, './Bluestore_productexport.log.text');
|
| 597 |
+
Mage::log('The Private Certificate cannnot be populated.', null, './Bluestore_productexport.log.text');
|
| 598 |
+
if(!$value_cron)
|
| 599 |
+
{
|
| 600 |
+
$this->_redirect('*/*');
|
| 601 |
+
break;
|
| 602 |
+
}
|
| 603 |
+
break;
|
| 604 |
+
}
|
| 605 |
+
else if($response == 'false')
|
| 606 |
+
{
|
| 607 |
+
$message = $this->__('There was a problem calling the Bluestore API. The data could not be exported. Please contact your site administrator.');
|
| 608 |
+
Mage::getSingleton('adminhtml/session')->addError($message);
|
| 609 |
+
Mage::log('The Private Certificate is created', null, './Bluestore_productexport.log.text');
|
| 610 |
+
Mage::log('The Private Certificate is populated', null, './Bluestore_productexport.log.text');
|
| 611 |
+
Mage::log('Product Export Failed, No Product Export', null, './Bluestore_productexport.log.text');
|
| 612 |
+
if(!$value_cron)
|
| 613 |
+
{
|
| 614 |
+
$this->_redirect('*/*');
|
| 615 |
+
break;
|
| 616 |
+
}
|
| 617 |
+
break;
|
| 618 |
+
}
|
| 619 |
+
else if($response == 'blankdata')
|
| 620 |
+
{
|
| 621 |
+
$message = $this->__('There is no more product record for export according to condition.');
|
| 622 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
| 623 |
+
Mage::log('The Private Certificate is created', null, './Bluestore_productexport.log.text');
|
| 624 |
+
Mage::log('The Private Certificate is populated', null, './Bluestore_productexport.log.text');
|
| 625 |
+
Mage::log('There is no more product record for export according to condition', null, './Bluestore_productexport.log.text');
|
| 626 |
+
if(!$value_cron)
|
| 627 |
+
{
|
| 628 |
+
$this->_redirect('*/*');
|
| 629 |
+
break;
|
| 630 |
+
}
|
| 631 |
+
break;
|
| 632 |
+
}
|
| 633 |
+
else
|
| 634 |
+
{
|
| 635 |
+
Mage::log('The Private Certificate is created', null, './Bluestore_productexport.log.text');
|
| 636 |
+
Mage::log('The Private Certificate is populated', null, './Bluestore_productexport.log.text');
|
| 637 |
+
Mage::log('The Product xml is populated.', null, './Bluestore_productexport.log.text');
|
| 638 |
+
Mage::log('Product Export Finished Successfully.', null, './Bluestore_productexport.log.text');
|
| 639 |
+
|
| 640 |
+
if(!$value_cron)
|
| 641 |
+
{
|
| 642 |
+
$message = $this->__('Products have been successfully exported.');
|
| 643 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
| 644 |
+
$this->_redirect('*/*');
|
| 645 |
+
break;
|
| 646 |
+
}
|
| 647 |
+
break;
|
| 648 |
+
}
|
| 649 |
+
}
|
| 650 |
+
|
| 651 |
+
}
|
| 652 |
+
catch (Exception $e)
|
| 653 |
+
{
|
| 654 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 655 |
+
}
|
| 656 |
+
break;
|
| 657 |
|
| 658 |
case 7: #### This case handles the category data export in csv
|
| 659 |
try
|
app/code/local/Bluefish/Connection/controllers/Adminhtml/Xml.php
CHANGED
|
@@ -120,6 +120,12 @@ function cron_insert_update1()
|
|
| 120 |
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopIteration= '".$counterDB."' where id = '".$resultProductIteration[0][id]."'");
|
| 121 |
|
| 122 |
$markers=$doc->getElementsByTagName('bluefish_connection_product');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
foreach ($markers as $marker)
|
| 124 |
{
|
| 125 |
$marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $Product_cron_schedule_time;
|
|
@@ -153,7 +159,7 @@ function cron_insert_update()
|
|
| 153 |
$categoryIterationCounter = $resultCategoryIteration[0]['loopCounter'];
|
| 154 |
$categoryCounterDB = $resultCategoryIteration[0]['loopIteration'];
|
| 155 |
|
| 156 |
-
$credentials
|
| 157 |
$commonschedule_category = $credentials['mycustom_category_defaultminuteschedule'];
|
| 158 |
$unserielCategoryVal = unserialize($commonschedule_category);
|
| 159 |
|
|
@@ -364,17 +370,17 @@ function insert_update_database2()
|
|
| 364 |
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
| 365 |
$xmlData = $xmlObj->getNode();
|
| 366 |
|
| 367 |
-
|
| 368 |
require_once $mageFilename;
|
| 369 |
Mage::setIsDeveloperMode(true);
|
| 370 |
|
| 371 |
umask(0);
|
| 372 |
Mage::app('admin');
|
| 373 |
Mage::register('isSecureArea', 1);
|
| 374 |
-
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID)
|
| 375 |
|
| 376 |
Mage::log('Stock Import started ......', null, './Bluestore_stock.log.text');
|
| 377 |
-
|
| 378 |
|
| 379 |
$updatesversionVal = array();
|
| 380 |
|
|
@@ -466,22 +472,18 @@ function insert_update_database2()
|
|
| 466 |
$ErrorMsg .= "$count > Error:: while Upating Qty ($quantity) of Sku ($productCode) => ".$e->getMessage().":";
|
| 467 |
Mage::log("$count > Error:: while Upating Qty ($quantity) of Sku ($productCode) => ".$e->getMessage()."", null, './Bluestore_stock.log.text');
|
| 468 |
}
|
| 469 |
-
}else{
|
| 470 |
-
$ErrorMsg .= "$count > Error:: Product with Sku ($productCode) does't exist.".":";
|
| 471 |
-
Mage::log("$count > Error:: Product with Sku ($productCode) does't exist.", null, './Bluestore_stock.log.text');
|
| 472 |
}
|
| 473 |
$count++;
|
| 474 |
}
|
| 475 |
}
|
| 476 |
if(count($xmlData) > 0)
|
| 477 |
{
|
| 478 |
-
$versionVal
|
| 479 |
-
|
| 480 |
-
$coreConfigUpdate = $connection->query("UPDATE ".$prefix."core_config_data SET value = '".$versionVal."' where path = 'mycustom_section/mycustom_stock_group/mycustom_currentstockversion'");
|
| 481 |
}
|
| 482 |
if($ErrorMsg != "")
|
| 483 |
{
|
| 484 |
-
$connection
|
| 485 |
$prefix = Mage::getConfig()->getTablePrefix();
|
| 486 |
$resultCronScheduleID = $connection->query("SELECT schedule_id FROM ".$prefix."cron_schedule WHERE job_code = 'bluefish_connection_stock' AND status = 'pending' ORDER BY schedule_id DESC LIMIT 1");
|
| 487 |
$resultSetScheduleID = $resultCronScheduleID->fetchAll(PDO::FETCH_OBJ);
|
|
@@ -511,7 +513,7 @@ function insert_update_database1()
|
|
| 511 |
$xmlPath = $appBaseDir.'/products_bluestore.xml';
|
| 512 |
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
| 513 |
$xmlData = $xmlObj->getNode();
|
| 514 |
-
|
| 515 |
$mage_url = Mage::getBaseUrl()."api/soap/?wsdl";
|
| 516 |
$credentials = Mage::getStoreConfig('mycustom_section/mycustom_auth_group');
|
| 517 |
|
|
@@ -523,22 +525,17 @@ function insert_update_database1()
|
|
| 523 |
|
| 524 |
Mage::log('Product Import started ......', null, './Bluestore_product.log.text');
|
| 525 |
|
| 526 |
-
$connection
|
| 527 |
$prefix = Mage::getConfig()->getTablePrefix();
|
| 528 |
-
|
| 529 |
-
$resultPath = $connection->query("select value from ".$prefix."core_config_data WHERE path = 'mycustom_section/mycustom_category_group/mycustom_category_mapping_direct'");
|
| 530 |
-
$resultCronPath = $resultPath->fetchAll(PDO::FETCH_ASSOC);
|
| 531 |
-
$numberRowsConfig= count($resultCronPath);
|
| 532 |
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
}
|
| 537 |
|
| 538 |
-
$credentialsTaxclass
|
| 539 |
-
$taxClassSerialArr
|
| 540 |
|
| 541 |
-
$unserielTaxClass
|
| 542 |
|
| 543 |
if(count($xmlData) > 0)
|
| 544 |
{
|
|
@@ -573,7 +570,7 @@ function insert_update_database1()
|
|
| 573 |
|
| 574 |
if($Deletestatus == "false")
|
| 575 |
{
|
| 576 |
-
if($unserielVal['#{_id}']['
|
| 577 |
{
|
| 578 |
$result = $connection->query("select code,category_id from ".$prefix."bluefish_category WHERE code = '".$categoryCode."'");
|
| 579 |
$resultSet = $result->fetchAll(PDO::FETCH_ASSOC);
|
|
@@ -702,7 +699,7 @@ function insert_update_database1()
|
|
| 702 |
}
|
| 703 |
}
|
| 704 |
}
|
| 705 |
-
if($unserielVal['#{_id}']['
|
| 706 |
{
|
| 707 |
$resultDirect = $connection->query("select code,category_id from ".$prefix."bluefish_category WHERE code = '".$categoryCode."'");
|
| 708 |
$resultSetDirect = $resultDirect->fetchAll(PDO::FETCH_ASSOC);
|
|
@@ -723,7 +720,6 @@ function insert_update_database1()
|
|
| 723 |
catch(Exception $e)
|
| 724 |
{
|
| 725 |
$flag = $e->getMessage();
|
| 726 |
-
$ErrorMsg .= "SKU - ".$codeSKU." ".$e->getMessage().":";
|
| 727 |
$returnmessage = $flag;
|
| 728 |
}
|
| 729 |
try
|
|
@@ -799,7 +795,7 @@ function insert_update_database1()
|
|
| 799 |
VALUES('','".$ScheduledID."','".$ErrorMsg."')");
|
| 800 |
}
|
| 801 |
}
|
| 802 |
-
$returnmessage = "success";
|
| 803 |
}
|
| 804 |
else
|
| 805 |
{
|
|
@@ -812,7 +808,7 @@ function insert_update_database1()
|
|
| 812 |
function insert_update_database()
|
| 813 |
{
|
| 814 |
set_time_limit(0);
|
| 815 |
-
|
| 816 |
$xmlPath = $appBaseDir.'/categories_bluefish.xml';
|
| 817 |
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
| 818 |
$xmlData = $xmlObj->getNode();
|
|
@@ -844,16 +840,11 @@ function insert_update_database()
|
|
| 844 |
Mage::log('Category Import started ......', null, './Bluestore_category.log.text');
|
| 845 |
|
| 846 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 847 |
-
$prefix
|
| 848 |
|
| 849 |
-
|
| 850 |
-
$
|
| 851 |
-
$
|
| 852 |
-
|
| 853 |
-
if($numberRows > 0)
|
| 854 |
-
{
|
| 855 |
-
$unserielVal = unserialize($resultCronPath[0][value]);
|
| 856 |
-
}
|
| 857 |
|
| 858 |
$rootCateogryId = Mage::app()->getStore('default')->getRootCategoryId();
|
| 859 |
function get_categories(){
|
|
@@ -1124,188 +1115,197 @@ function insert_update_database()
|
|
| 1124 |
##### Function for Create/Update the magento customer
|
| 1125 |
function insert_update_database3()
|
| 1126 |
{
|
| 1127 |
-
|
| 1128 |
-
|
| 1129 |
-
|
| 1130 |
-
|
| 1131 |
|
| 1132 |
-
|
| 1133 |
-
|
| 1134 |
|
| 1135 |
-
|
| 1136 |
-
|
| 1137 |
|
| 1138 |
-
|
| 1139 |
-
|
| 1140 |
|
| 1141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1142 |
|
| 1143 |
-
|
| 1144 |
-
|
| 1145 |
-
$code = $xmlData->customer[$i]->code;
|
| 1146 |
-
$externalRef = $xmlData->customer[$i]->externalRef;
|
| 1147 |
-
$taxOrVatRef = $xmlData->customer[$i]->taxOrVatRef;
|
| 1148 |
-
$createdOn = $xmlData->customer[$i]->createdOn;
|
| 1149 |
-
$Addresscode = $xmlData->customer[$i]->address->code;
|
| 1150 |
-
$isCorresponden = $xmlData->customer[$i]->address->isCorrespondence;
|
| 1151 |
-
$isBilling = $xmlData->customer[$i]->address->isBilling;
|
| 1152 |
-
$isDelivery = $xmlData->customer[$i]->address->isDelivery;
|
| 1153 |
-
$title = $xmlData->customer[$i]->address->title;
|
| 1154 |
-
$firstName = $xmlData->customer[$i]->address->firstName;
|
| 1155 |
-
$lastName = $xmlData->customer[$i]->address->lastName;
|
| 1156 |
-
$companyName = $xmlData->customer[$i]->address->companyName;
|
| 1157 |
-
$street1 = $xmlData->customer[$i]->address->street1;
|
| 1158 |
-
$street2 = $xmlData->customer[$i]->address->street2;
|
| 1159 |
-
$street3 = $xmlData->customer[$i]->address->street3;
|
| 1160 |
-
$city = $xmlData->customer[$i]->address->city;
|
| 1161 |
-
$stateOrRegion = $xmlData->customer[$i]->address->stateOrRegion;
|
| 1162 |
-
$postalCode = $xmlData->customer[$i]->address->postalCode;
|
| 1163 |
-
$country = $xmlData->customer[$i]->address->country;
|
| 1164 |
-
$phone1 = $xmlData->customer[$i]->address->phone1;
|
| 1165 |
-
$phone2 = $xmlData->customer[$i]->address->phone2;
|
| 1166 |
-
$email = $xmlData->customer[$i]->address->email;
|
| 1167 |
|
| 1168 |
-
|
| 1169 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 1170 |
-
|
| 1171 |
-
$result = $connection->query("SELECT id,customer_id,address_id FROM ".$prefix."bluefish_customer WHERE customer_code = '".$code."'");
|
| 1172 |
|
| 1173 |
-
|
| 1174 |
-
|
| 1175 |
|
| 1176 |
-
|
|
|
|
|
|
|
| 1177 |
{
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
$customerID = $soap->call($sessionId,'customer.create',array(array('email' => "$email", 'firstname' => "$firstName", 'lastname' => "$lastName", 'prefix' => "$title", 'website_id' => 1, 'store_id' => 1, 'group_id' => 1,'created_at'=> "$createdOn")));
|
| 1181 |
-
$address_id = "";
|
| 1182 |
|
| 1183 |
-
|
|
|
|
|
|
|
| 1184 |
{
|
| 1185 |
-
|
| 1186 |
-
{
|
| 1187 |
-
$address_id = $soap->call($sessionId,'customer_address.create',array('customerId' => "$customerID", 'addressdata' => array('firstname' => "$firstName", 'lastname' => "$lastName", 'street' => array("$street1", "$street2", "$street3"), 'city' => "$city", 'country_id' => "$country", 'region' => "$stateOrRegion", 'region_id' => 3, 'postcode' => "$postalCode", 'telephone' => "$phone1", 'is_default_billing' => "$isBilling", 'is_default_shipping' => "$isDelivery", 'company' => "$companyName", 'prefix' => "$title")));
|
| 1188 |
-
}
|
| 1189 |
-
catch(Exception $e)
|
| 1190 |
-
{
|
| 1191 |
-
$flag = $e->getMessage();
|
| 1192 |
-
$ErrorMsg .= $firstName." ".$lastName." - ".$e->getMessage().":";
|
| 1193 |
-
$flag = "fail";
|
| 1194 |
-
}
|
| 1195 |
}
|
| 1196 |
-
|
| 1197 |
{
|
| 1198 |
-
$
|
| 1199 |
-
|
|
|
|
| 1200 |
}
|
| 1201 |
-
|
| 1202 |
-
$InsertCus = $connection->query("INSERT INTO ".$prefix."bluefish_customer(id,customer_id,address_id,customer_code,created_time,update_time)
|
| 1203 |
-
VALUES('','".$customerID."','".$address_id."','".$code."','".now()."','')");
|
| 1204 |
-
|
| 1205 |
-
Mage::log('Customer '.$customerID.' Created.', null, './Bluestore_customer.log.text');
|
| 1206 |
-
$flag = "success";
|
| 1207 |
}
|
| 1208 |
-
|
| 1209 |
{
|
| 1210 |
-
$
|
| 1211 |
-
|
| 1212 |
-
Mage::log('Customer not created - '.$flag.'.', null, './Bluestore_customer.log.text');
|
| 1213 |
-
$flag = "Not Created";
|
| 1214 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1215 |
}
|
| 1216 |
-
|
| 1217 |
{
|
| 1218 |
-
|
| 1219 |
-
|
| 1220 |
-
|
| 1221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1222 |
|
| 1223 |
-
|
| 1224 |
|
| 1225 |
-
|
| 1226 |
-
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
|
| 1230 |
-
|
| 1231 |
|
| 1232 |
-
|
| 1233 |
-
|
| 1234 |
-
|
| 1235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1236 |
{
|
| 1237 |
-
$
|
| 1238 |
|
| 1239 |
-
|
| 1240 |
{
|
| 1241 |
-
$
|
|
|
|
| 1242 |
|
| 1243 |
-
|
| 1244 |
{
|
| 1245 |
-
|
| 1246 |
-
$address_id = "";
|
| 1247 |
-
|
| 1248 |
-
if(($city != "") && ($postalCode !="") && ($phone1 != "") && ($street1 != ""))
|
| 1249 |
{
|
| 1250 |
-
|
| 1251 |
-
|
| 1252 |
-
|
| 1253 |
-
|
| 1254 |
-
|
| 1255 |
-
|
| 1256 |
-
|
| 1257 |
-
$ErrorMsg .= $firstName." ".$lastName." - ".$e->getMessage().":";
|
| 1258 |
-
$flag = "fail";
|
| 1259 |
-
}
|
| 1260 |
}
|
| 1261 |
-
|
| 1262 |
-
$InsertCus = $connection->query("INSERT INTO ".$prefix."bluefish_customer(id,customer_id,address_id,customer_code,created_time,update_time)
|
| 1263 |
-
VALUES('','".$customerID."','".$address_id."','".$code."','".now()."','')");
|
| 1264 |
-
|
| 1265 |
-
Mage::log('Customer '.$customerID.' Created.', null, './Bluestore_customer.log.text');
|
| 1266 |
-
$flag = "success";
|
| 1267 |
}
|
| 1268 |
-
catch(Exception $e)
|
| 1269 |
-
{
|
| 1270 |
-
$flag = $e->getMessage();
|
| 1271 |
-
$ErrorMsg .= $firstName." ".$lastName." - ".$e->getMessage().":";
|
| 1272 |
-
Mage::log('Customer '.$customerID.' not created.', null, './Bluestore_customer.log.text');
|
| 1273 |
|
| 1274 |
-
|
| 1275 |
-
|
|
|
|
|
|
|
|
|
|
| 1276 |
}
|
| 1277 |
-
|
| 1278 |
{
|
| 1279 |
-
|
| 1280 |
-
$ErrorMsg .=
|
| 1281 |
-
|
|
|
|
|
|
|
| 1282 |
}
|
| 1283 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1284 |
}
|
| 1285 |
}
|
| 1286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1287 |
{
|
| 1288 |
-
$
|
| 1289 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 1290 |
-
$resultCronScheduleID = $connection->query("SELECT schedule_id FROM ".$prefix."cron_schedule WHERE job_code = 'bluefish_connection_customer' AND status = 'pending' ORDER BY schedule_id DESC LIMIT 1");
|
| 1291 |
-
$resultSetScheduleID = $resultCronScheduleID->fetchAll(PDO::FETCH_OBJ);
|
| 1292 |
-
|
| 1293 |
-
$ScheduledID = $resultSetScheduleID[0]->schedule_id;
|
| 1294 |
-
$numberRows = count($resultSetScheduleID);
|
| 1295 |
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
|
| 1299 |
-
|
| 1300 |
-
|
| 1301 |
-
|
| 1302 |
-
|
| 1303 |
-
|
| 1304 |
-
|
|
|
|
| 1305 |
}
|
| 1306 |
|
| 1307 |
##### Function for import Bluestore sales
|
| 1308 |
-
function importBluestoreSales()
|
| 1309 |
{
|
| 1310 |
$appBaseDir = Mage::getBaseDir();
|
| 1311 |
$xmlPath = $appBaseDir.'/sales_bluestore_import.xml';
|
|
@@ -1321,7 +1321,7 @@ function importBluestoreSales()
|
|
| 1321 |
$soap = new SoapClient($mage_url);
|
| 1322 |
$sessionId = $soap->login($mage_user, $mage_api_key);
|
| 1323 |
|
| 1324 |
-
$credentials_sales = Mage::getStoreConfig('mycustom_section/
|
| 1325 |
$guestCustomerCode = $credentials_sales['mycustom_customer_idimport'];
|
| 1326 |
|
| 1327 |
Mage::log('Sales Import started ......', null, './Bluestore_sales_import.log.text');
|
|
@@ -1329,361 +1329,530 @@ function importBluestoreSales()
|
|
| 1329 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1330 |
$prefix = Mage::getConfig()->getTablePrefix();
|
| 1331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1332 |
for($i=0;$i<count($xmlData);$i++)
|
| 1333 |
{
|
| 1334 |
$error = "";
|
| 1335 |
-
|
| 1336 |
-
|
| 1337 |
-
|
| 1338 |
-
|
| 1339 |
-
|
| 1340 |
-
|
| 1341 |
-
|
| 1342 |
-
|
| 1343 |
-
|
| 1344 |
-
|
| 1345 |
-
|
| 1346 |
-
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
$
|
| 1352 |
-
$arrProducts = array();
|
| 1353 |
-
|
| 1354 |
-
$paymentMethod = $xmlData->sale[$i]->payments->payment->tenderType;
|
| 1355 |
-
$transactionCode = $xmlData->sale[$i]->transactionCode;
|
| 1356 |
-
$updateLastDateArr[] = $xmlData->sale[$i]->endDate." ".$xmlData->sale[$i]->timezoneId;
|
| 1357 |
-
|
| 1358 |
|
| 1359 |
-
$
|
| 1360 |
-
$
|
| 1361 |
-
$numberFailureorder = count($resultSetFailureorder);
|
| 1362 |
|
| 1363 |
-
|
| 1364 |
-
|
| 1365 |
-
|
| 1366 |
-
|
| 1367 |
-
|
| 1368 |
-
|
| 1369 |
-
|
| 1370 |
-
|
| 1371 |
-
|
| 1372 |
-
foreach ($customer->getAddresses() as $address)
|
| 1373 |
{
|
| 1374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1375 |
}
|
| 1376 |
-
|
| 1377 |
-
$firstname = $customerAddress[firstname];
|
| 1378 |
-
$lastname = $customerAddress[lastname];
|
| 1379 |
-
$company = $customerAddress[company];
|
| 1380 |
-
$street = $customerAddress[street];
|
| 1381 |
-
$city = $customerAddress[city];
|
| 1382 |
-
$region = $customerAddress[region];
|
| 1383 |
-
$postcode = $customerAddress[postcode];
|
| 1384 |
-
$country_id = $customerAddress[country_id];
|
| 1385 |
-
$telephone = $customerAddress[telephone];
|
| 1386 |
-
$email = $customer->getEmail();
|
| 1387 |
-
}
|
| 1388 |
-
else{
|
| 1389 |
-
$street = "";
|
| 1390 |
-
|
| 1391 |
-
$customer = Mage::getModel('customer/customer')->load($guestCustomerCode);
|
| 1392 |
-
$customerAddress = array();
|
| 1393 |
-
|
| 1394 |
-
foreach ($customer->getAddresses() as $address)
|
| 1395 |
{
|
| 1396 |
-
|
| 1397 |
-
|
| 1398 |
-
|
| 1399 |
-
|
| 1400 |
-
|
| 1401 |
-
|
| 1402 |
-
|
| 1403 |
-
|
| 1404 |
-
|
| 1405 |
-
|
| 1406 |
-
}
|
| 1407 |
-
if(!empty($xmlData->sale[$i]->customer->street3)){
|
| 1408 |
-
$street3 = (string)$xmlData->sale[$i]->customer->street3;
|
| 1409 |
-
$street3 = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $street3);
|
| 1410 |
-
}
|
| 1411 |
-
|
| 1412 |
-
$street = $street1;
|
| 1413 |
-
|
| 1414 |
-
if($street2 != ""){
|
| 1415 |
-
$street .= " ".$street2;
|
| 1416 |
-
}
|
| 1417 |
-
if($street3 != ""){
|
| 1418 |
-
$street .= " ".$street3;
|
| 1419 |
}
|
| 1420 |
|
| 1421 |
-
if(empty($street)){
|
| 1422 |
-
$street = $customerAddress[street];
|
| 1423 |
-
}
|
| 1424 |
-
if(!empty($xmlData->sale[$i]->customer->firstName)){
|
| 1425 |
-
$firstname = (string)$xmlData->sale[$i]->customer->firstName;
|
| 1426 |
-
$firstname = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $firstname);
|
| 1427 |
-
}
|
| 1428 |
-
if(!empty($xmlData->sale[$i]->customer->lastName)){
|
| 1429 |
-
$lastname = (string)$xmlData->sale[$i]->customer->lastName;
|
| 1430 |
-
$lastname = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $lastname);
|
| 1431 |
-
}
|
| 1432 |
-
if(!empty($xmlData->sale[$i]->customer->townCity)){
|
| 1433 |
-
$city = (string)$xmlData->sale[$i]->customer->townCity;
|
| 1434 |
-
$city = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $city);
|
| 1435 |
-
}
|
| 1436 |
-
else{
|
| 1437 |
-
$city = $customerAddress[city];
|
| 1438 |
-
}
|
| 1439 |
-
if(!empty($xmlData->sale[$i]->customer->stateRegion)){
|
| 1440 |
-
$region = (string)$xmlData->sale[$i]->customer->stateRegion;
|
| 1441 |
-
$region = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $region);
|
| 1442 |
-
}
|
| 1443 |
-
if(!empty($xmlData->sale[$i]->customer->postalZipCode)){
|
| 1444 |
-
$postcode = (string)$xmlData->sale[$i]->customer->postalZipCode;
|
| 1445 |
-
$postcode = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $postcode);
|
| 1446 |
-
}
|
| 1447 |
-
else{
|
| 1448 |
-
$postcode = $customerAddress[postcode];
|
| 1449 |
-
}
|
| 1450 |
-
if(!empty($xmlData->sale[$i]->customer->countryCode)){
|
| 1451 |
-
$country_id = (string)$xmlData->sale[$i]->customer->countryCode;
|
| 1452 |
-
$country_id = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $country_id);
|
| 1453 |
-
}
|
| 1454 |
-
if(!empty($xmlData->sale[$i]->customer->telephone1) && strlen($xmlData->sale[$i]->customer->telephone1) >9){
|
| 1455 |
-
$telephone = (string)$xmlData->sale[$i]->customer->telephone1;
|
| 1456 |
-
$telephone = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $telephone);
|
| 1457 |
-
}
|
| 1458 |
-
else {
|
| 1459 |
-
$telephone = $customerAddress[telephone];
|
| 1460 |
-
}
|
| 1461 |
-
if(!empty($xmlData->sale[$i]->customer->email)){
|
| 1462 |
-
$email = (string)$xmlData->sale[$i]->customer->email;
|
| 1463 |
-
$email = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $email);
|
| 1464 |
-
}
|
| 1465 |
-
else {
|
| 1466 |
-
$email = $customer->getEmail();
|
| 1467 |
-
}
|
| 1468 |
-
$company = "";
|
| 1469 |
}
|
| 1470 |
|
| 1471 |
-
|
| 1472 |
-
|
| 1473 |
-
$productCode = $xmlData->sale[$i]->items->item[$j]->productCode;
|
| 1474 |
-
$quantity_item = $xmlData->sale[$i]->items->item[$j]->quantity;
|
| 1475 |
-
$quantity_item = (int)$quantity_item;
|
| 1476 |
-
|
| 1477 |
-
$magentoProductId = Mage::getModel("catalog/product")->getIdBySku($productCode);
|
| 1478 |
-
|
| 1479 |
-
$arrProducts[$j] = array(
|
| 1480 |
-
'product_id' => "$magentoProductId",
|
| 1481 |
-
'quantity' => "$quantity_item"
|
| 1482 |
-
);
|
| 1483 |
-
|
| 1484 |
-
}
|
| 1485 |
-
|
| 1486 |
-
|
| 1487 |
-
try{
|
| 1488 |
-
$shoppingCartIncrementId = $soap->call( $sessionId, 'cart.create');
|
| 1489 |
-
}
|
| 1490 |
-
catch(Exception $e){
|
| 1491 |
-
$error .= $e->getMessage()."<br>";
|
| 1492 |
-
}
|
| 1493 |
-
|
| 1494 |
-
try{
|
| 1495 |
-
$resultCartProductAdd = $soap->call(
|
| 1496 |
-
$sessionId,
|
| 1497 |
-
"cart_product.add",
|
| 1498 |
-
array(
|
| 1499 |
-
$shoppingCartIncrementId,
|
| 1500 |
-
$arrProducts
|
| 1501 |
-
)
|
| 1502 |
-
);
|
| 1503 |
-
}
|
| 1504 |
-
catch(Exception $e){
|
| 1505 |
-
$error .= $e->getMessage()."<br>";
|
| 1506 |
-
}
|
| 1507 |
-
|
| 1508 |
-
$shoppingCartId = $shoppingCartIncrementId;
|
| 1509 |
-
|
| 1510 |
-
$customer = array(
|
| 1511 |
-
"firstname" => $firstname,
|
| 1512 |
-
"lastname" => $lastname,
|
| 1513 |
-
"website_id" => "1",
|
| 1514 |
-
"group_id" => "1",
|
| 1515 |
-
"store_id" => "1",
|
| 1516 |
-
"email" => $email,
|
| 1517 |
-
"mode" => "guest",
|
| 1518 |
-
);
|
| 1519 |
-
|
| 1520 |
-
try{
|
| 1521 |
-
$resultCustomerSet = $soap->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customer) );
|
| 1522 |
-
}
|
| 1523 |
-
catch(Exception $e){
|
| 1524 |
-
$error .= $e->getMessage()."<br>";
|
| 1525 |
-
}
|
| 1526 |
-
|
| 1527 |
-
// Set customer addresses, for example guest's addresses
|
| 1528 |
-
$arrAddresses = array(
|
| 1529 |
-
array(
|
| 1530 |
-
"mode" => "shipping",
|
| 1531 |
-
"firstname" => $firstname,
|
| 1532 |
-
"lastname" => $lastname,
|
| 1533 |
-
"company" => $company,
|
| 1534 |
-
"street" => $street,
|
| 1535 |
-
"city" => $city,
|
| 1536 |
-
"region" => $region,
|
| 1537 |
-
"postcode" => $postcode,
|
| 1538 |
-
"country_id" => $country_id,
|
| 1539 |
-
"telephone" => "$telephone",
|
| 1540 |
-
"is_default_shipping" => 0,
|
| 1541 |
-
"is_default_billing" => 0
|
| 1542 |
-
),
|
| 1543 |
-
array(
|
| 1544 |
-
"mode" => "billing",
|
| 1545 |
-
"firstname" => $firstname,
|
| 1546 |
-
"lastname" => $lastname,
|
| 1547 |
-
"company" => $company,
|
| 1548 |
-
"street" => $street,
|
| 1549 |
-
"city" => $city,
|
| 1550 |
-
"region" => $region,
|
| 1551 |
-
"postcode" => $postcode,
|
| 1552 |
-
"country_id" => $country_id,
|
| 1553 |
-
"telephone" => "$telephone",
|
| 1554 |
-
"is_default_shipping" => 0,
|
| 1555 |
-
"is_default_billing" => 0
|
| 1556 |
-
)
|
| 1557 |
-
);
|
| 1558 |
-
|
| 1559 |
-
try{
|
| 1560 |
-
$resultCustomerAddresses = $soap->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses));
|
| 1561 |
-
}
|
| 1562 |
-
catch(Exception $e){
|
| 1563 |
-
$error .= $e->getMessage()."<br>";
|
| 1564 |
-
}
|
| 1565 |
-
|
| 1566 |
-
$shippingMethod = "bluefish_connection_bluefish_connection";
|
| 1567 |
-
|
| 1568 |
-
try{
|
| 1569 |
-
$resultShippingMethod = $soap->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod));
|
| 1570 |
-
}
|
| 1571 |
-
catch(Exception $e){
|
| 1572 |
-
$error .= $e->getMessage()."<br>";
|
| 1573 |
-
}
|
| 1574 |
|
| 1575 |
-
|
| 1576 |
-
$
|
| 1577 |
|
| 1578 |
-
#### set payment method
|
| 1579 |
-
$paymentMethod = array(
|
| 1580 |
-
"method" => $paymentMethod
|
| 1581 |
-
);
|
| 1582 |
|
| 1583 |
-
|
| 1584 |
-
|
| 1585 |
-
|
| 1586 |
-
catch(Exception $e){
|
| 1587 |
-
$error .= $e->getMessage()."<br>";
|
| 1588 |
-
}
|
| 1589 |
|
| 1590 |
-
|
| 1591 |
-
|
| 1592 |
-
|
| 1593 |
-
#echo "<pre>";
|
| 1594 |
-
#print_r($shoppingCartInfo);die;
|
| 1595 |
-
|
| 1596 |
-
$item_array = $shoppingCartInfo[items];
|
| 1597 |
-
|
| 1598 |
-
$item_id = array();
|
| 1599 |
-
|
| 1600 |
-
foreach($item_array as $item_key=>$item_val){
|
| 1601 |
-
$item_id[] = $item_val[item_id];
|
| 1602 |
-
}
|
| 1603 |
-
|
| 1604 |
-
for($k=0;$k<count($xmlData->sale[$i]->items->item);$k++){
|
| 1605 |
|
| 1606 |
-
$
|
| 1607 |
-
$
|
| 1608 |
-
$
|
| 1609 |
-
$quantity = (int)$xmlData->sale[$i]->items->item[$k]->quantity;
|
| 1610 |
-
$finalAmountExclTax = (float)$xmlData->sale[$i]->items->item[$k]->finalAmountExclTax;
|
| 1611 |
|
| 1612 |
-
|
| 1613 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1614 |
|
| 1615 |
-
$
|
| 1616 |
-
|
| 1617 |
-
|
| 1618 |
-
|
| 1619 |
-
WHERE `sales_flat_quote_item`.`item_id` =".$item_id[$k]);
|
| 1620 |
|
| 1621 |
-
|
| 1622 |
-
|
| 1623 |
-
|
| 1624 |
-
|
| 1625 |
-
|
| 1626 |
-
|
| 1627 |
-
|
| 1628 |
-
|
| 1629 |
-
|
| 1630 |
-
|
| 1631 |
-
|
| 1632 |
-
|
| 1633 |
-
|
| 1634 |
-
//create invoice for the order
|
| 1635 |
-
$invoice = $order->prepareInvoice()
|
| 1636 |
-
->setTransactionId($order->getId())
|
| 1637 |
-
->addComment("Invoice created from Bluestore extension.")
|
| 1638 |
-
->register()
|
| 1639 |
-
->pay();
|
| 1640 |
-
|
| 1641 |
-
$transaction_save = Mage::getModel('core/resource_transaction')
|
| 1642 |
-
->addObject($invoice)
|
| 1643 |
-
->addObject($invoice->getOrder());
|
| 1644 |
|
| 1645 |
-
$
|
| 1646 |
-
|
| 1647 |
-
|
| 1648 |
-
|
| 1649 |
-
|
| 1650 |
-
|
| 1651 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1652 |
|
| 1653 |
-
|
| 1654 |
-
|
| 1655 |
-
|
| 1656 |
-
|
| 1657 |
-
|
| 1658 |
-
|
| 1659 |
-
|
| 1660 |
-
|
| 1661 |
-
|
| 1662 |
-
|
| 1663 |
-
|
| 1664 |
-
|
| 1665 |
-
|
| 1666 |
-
|
| 1667 |
-
|
| 1668 |
-
|
| 1669 |
-
|
| 1670 |
-
|
| 1671 |
-
|
| 1672 |
-
|
| 1673 |
-
|
| 1674 |
-
|
| 1675 |
-
|
| 1676 |
-
|
| 1677 |
-
|
| 1678 |
-
|
| 1679 |
-
|
| 1680 |
-
|
| 1681 |
-
|
| 1682 |
-
|
| 1683 |
-
|
| 1684 |
-
|
| 1685 |
-
|
| 1686 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1687 |
$flag = "fail";
|
| 1688 |
}elseif(count($xmlData) == 0){
|
| 1689 |
$flag = "blankdata";
|
|
@@ -1693,6 +1862,7 @@ function importBluestoreSales()
|
|
| 1693 |
return $flag;
|
| 1694 |
}
|
| 1695 |
|
|
|
|
| 1696 |
##### Function for generate the completed sales data xml for bluestore
|
| 1697 |
function ExportOrderData()
|
| 1698 |
{
|
|
@@ -1727,9 +1897,10 @@ function ExportOrderData()
|
|
| 1727 |
$SaleIterationCounter = $resultSaleIteration[0][loopCounter];
|
| 1728 |
$SaleCounterDB = $resultSaleIteration[0][loopIteration];
|
| 1729 |
|
| 1730 |
-
$credentials
|
| 1731 |
$commonschedule_Sale = $credentials['mycustom_sales_commonschedule'];
|
| 1732 |
$unserielSaleVal = unserialize($commonschedule_Sale);
|
|
|
|
| 1733 |
|
| 1734 |
$SaleCount = 0;
|
| 1735 |
|
|
@@ -1761,7 +1932,7 @@ function ExportOrderData()
|
|
| 1761 |
|
| 1762 |
$markers=$doc->getElementsByTagName('bluefish_connection_orderexport');
|
| 1763 |
$markersimport =$doc->getElementsByTagName('bluefish_connection_orderimport');
|
| 1764 |
-
|
| 1765 |
foreach ($markers as $marker)
|
| 1766 |
{
|
| 1767 |
$type=$marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $Sale_cron_schedule_time;
|
|
@@ -1777,11 +1948,18 @@ function ExportOrderData()
|
|
| 1777 |
|
| 1778 |
try
|
| 1779 |
{
|
| 1780 |
-
|
| 1781 |
-
|
| 1782 |
-
|
| 1783 |
-
|
| 1784 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1785 |
}
|
| 1786 |
catch(Exception $e)
|
| 1787 |
{
|
|
@@ -1795,266 +1973,264 @@ function ExportOrderData()
|
|
| 1795 |
print_r($resultOrderList);
|
| 1796 |
exit;*/
|
| 1797 |
|
|
|
|
| 1798 |
for($i=0;$i<count($resultOrderList);$i++)
|
| 1799 |
{
|
| 1800 |
$catchError = "";
|
| 1801 |
$catchProductError = "";
|
| 1802 |
-
#### need to comment below line after testing
|
| 1803 |
-
|
| 1804 |
-
#if($resultOrderList[$i][increment_id] == "100000002") # This one
|
| 1805 |
-
#{ # and this one
|
| 1806 |
-
$result = $connection->query("SELECT id FROM ".$prefix."bluefish_sale_post WHERE order_id = '".$resultOrderList[$i][increment_id]."'");
|
| 1807 |
|
| 1808 |
-
|
| 1809 |
-
$numberRows = count($resultSet);
|
| 1810 |
|
| 1811 |
-
|
|
|
|
| 1812 |
|
| 1813 |
-
|
| 1814 |
|
| 1815 |
-
|
| 1816 |
-
|
| 1817 |
-
|
| 1818 |
-
|
| 1819 |
-
|
| 1820 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1821 |
{
|
| 1822 |
-
$
|
| 1823 |
-
|
| 1824 |
-
|
|
|
|
| 1825 |
|
| 1826 |
-
if(
|
| 1827 |
{
|
| 1828 |
-
|
| 1829 |
-
try
|
| 1830 |
-
{
|
| 1831 |
-
$resultSalesOrder = $soap->call($sessionId, 'sales_order.info', $resultOrderList[$i][increment_id]);
|
| 1832 |
-
}
|
| 1833 |
-
catch(Exception $e)
|
| 1834 |
{
|
| 1835 |
-
|
| 1836 |
-
|
| 1837 |
-
|
| 1838 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1839 |
|
| 1840 |
-
if($
|
| 1841 |
{
|
| 1842 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1843 |
{
|
| 1844 |
try
|
| 1845 |
{
|
| 1846 |
-
$
|
| 1847 |
}
|
| 1848 |
catch(Exception $e)
|
| 1849 |
{
|
| 1850 |
$flag = $e->getMessage();
|
| 1851 |
-
Mage::log('Product for sale item '.$resultSalesOrder[items][$
|
| 1852 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1853 |
}
|
| 1854 |
-
|
| 1855 |
-
}
|
| 1856 |
-
if($catchProductError == "")
|
| 1857 |
-
{
|
| 1858 |
-
if($zz == 0)
|
| 1859 |
-
{
|
| 1860 |
-
$xmlRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
| 1861 |
-
<inbound lang=\"en\" enterprise=\"".$enterprise_code."\" requestNo=\"1\">
|
| 1862 |
-
";
|
| 1863 |
-
}
|
| 1864 |
-
$customerFullName = $resultOrderList[$i][customer_firstname];
|
| 1865 |
-
|
| 1866 |
-
if($resultOrderList[$i][customer_lastname] != "")
|
| 1867 |
-
$customerFullName = $resultOrderList[$i][customer_firstname]." ".$resultOrderList[$i][customer_lastname];
|
| 1868 |
-
$docNO = $zz+1;
|
| 1869 |
-
|
| 1870 |
-
$AmountsIncludeTax = ($resultOrderList[$i][tax_amount] > 0)?'true':'false';
|
| 1871 |
-
$saleAmountIncludeTax = $resultOrderList[$i][total_paid];
|
| 1872 |
-
|
| 1873 |
-
$xmlRequest .= "<batch batchNo=\"".$docNO."\">
|
| 1874 |
-
<transactionSales>
|
| 1875 |
-
<transactionSale docNo=\"".$resultOrderList[$i][increment_id]."\">
|
| 1876 |
-
<postStockMovements>true</postStockMovements>
|
| 1877 |
-
<saleHeader>
|
| 1878 |
-
<terminalTransactionNo>".$resultOrderList[$i][increment_id]."</terminalTransactionNo>
|
| 1879 |
-
<storeCode>".$mycustom_bluestorecode."</storeCode>
|
| 1880 |
-
<terminalCode>1</terminalCode>
|
| 1881 |
-
<startDateTime>".$resultOrderList[$i][created_at]."</startDateTime>
|
| 1882 |
-
<endDateTime>".$resultOrderList[$i][updated_at]."</endDateTime>
|
| 1883 |
-
<sessionID>".$sessionId."</sessionID>
|
| 1884 |
-
<userCode>".$resultcustomer_id."</userCode>
|
| 1885 |
-
<orderCurrencyCode>".$resultOrderList[$i][base_currency_code]."</orderCurrencyCode>
|
| 1886 |
-
<saleAmount>".$saleAmountIncludeTax."</saleAmount>
|
| 1887 |
-
<totalTax>".$resultOrderList[$i][tax_amount]."</totalTax>
|
| 1888 |
-
<amountsIncludeTax>".$AmountsIncludeTax."</amountsIncludeTax>
|
| 1889 |
-
</saleHeader>
|
| 1890 |
-
";
|
| 1891 |
-
|
| 1892 |
-
|
| 1893 |
-
### For sale order info
|
| 1894 |
-
try
|
| 1895 |
-
{
|
| 1896 |
-
$resultSalesOrder = $soap->call($sessionId, 'sales_order.info', $resultOrderList[$i][increment_id]);
|
| 1897 |
-
}
|
| 1898 |
-
catch(Exception $e)
|
| 1899 |
{
|
| 1900 |
$flag = $e->getMessage();
|
| 1901 |
-
Mage::log('Problem in
|
| 1902 |
-
|
| 1903 |
-
|
| 1904 |
-
$SalefirstName = str_ireplace("&", "&", $resultSalesOrder[customer_firstname]);
|
| 1905 |
-
$SalelastName = str_ireplace("&", "&", $resultSalesOrder[customer_lastname]);
|
| 1906 |
-
$street1Addr = str_ireplace("&", "&", $resultSalesOrder[shipping_address][street]);
|
| 1907 |
-
|
| 1908 |
-
$xmlRequest .= "<customer>
|
| 1909 |
-
<countryCode>".$resultSalesOrder[shipping_address][country_id]."</countryCode>
|
| 1910 |
-
<customerCode>".$customerCodeafterCheck."</customerCode>
|
| 1911 |
-
<email>".$resultSalesOrder[customer_email]."</email>
|
| 1912 |
-
<firstName>".$SalefirstName."</firstName>
|
| 1913 |
-
<lastName>".$SalelastName."</lastName>
|
| 1914 |
-
<postalZipCode>".$resultSalesOrder[shipping_address][postcode]."</postalZipCode>
|
| 1915 |
-
<street1>".$street1Addr."</street1>
|
| 1916 |
-
<telephone1>".$resultSalesOrder[shipping_address][telephone]."</telephone1>
|
| 1917 |
-
<title>".$resultSalesOrder[customer_prefix]."</title>
|
| 1918 |
-
<townCity>".$resultSalesOrder[shipping_address][city]."</townCity>
|
| 1919 |
-
</customer>
|
| 1920 |
-
<saleItems>";
|
| 1921 |
-
|
| 1922 |
-
$ITEM_NUMBER = 0;
|
| 1923 |
-
$saleItemChargeAmt = $resultSalesOrder[base_shipping_amount]/count($resultSalesOrder[items]);
|
| 1924 |
-
|
| 1925 |
-
for($j=0;$j<count($resultSalesOrder[items]);$j++)
|
| 1926 |
-
{
|
| 1927 |
-
try
|
| 1928 |
-
{
|
| 1929 |
-
$resultProduct = $soap->call($sessionId, 'catalog_product.info', $resultSalesOrder[items][$j][product_id]);
|
| 1930 |
-
}
|
| 1931 |
-
catch(Exception $e)
|
| 1932 |
-
{
|
| 1933 |
-
$flag = $e->getMessage();
|
| 1934 |
-
Mage::log('Product for sale item '.$resultSalesOrder[items][$j][product_id].' does not exist. Order# is '.$resultOrderList[$i][increment_id], null, './Bluestore_salesorder.log.text');
|
| 1935 |
-
$catchError = "fail";
|
| 1936 |
-
}
|
| 1937 |
-
|
| 1938 |
-
try
|
| 1939 |
-
{
|
| 1940 |
-
$config_saledefaultcategory = $credentials['mycustom_saledefaultcategory'];
|
| 1941 |
-
$saledefaultcategory = ($resultProduct[categories][0] == "")?$config_saledefaultcategory:$resultProduct[categories][0];
|
| 1942 |
-
$resultCategory = $soap->call($sessionId, 'catalog_category.info', $saledefaultcategory);
|
| 1943 |
-
}
|
| 1944 |
-
catch(Exception $e)
|
| 1945 |
-
{
|
| 1946 |
-
$flag = $e->getMessage();
|
| 1947 |
-
Mage::log('Problem in catalog_category.info '.$flag.' => '.$resultProduct[categories][0].' Exported.', null, './Bluestore_salesorder.log.text');
|
| 1948 |
-
$catchError = "fail";
|
| 1949 |
-
}
|
| 1950 |
-
|
| 1951 |
-
$resultCategoryCode = $connection->query("SELECT code FROM ".$prefix."bluefish_category WHERE category_id = '".$resultCategory[category_id]."'");
|
| 1952 |
-
$resultSetCatCode = $resultCategoryCode->fetchAll(PDO::FETCH_ASSOC);
|
| 1953 |
-
$updateCategoryCode = ($resultSetCatCode[0][code] == "")?$resultCategory[category_id]:$resultSetCatCode[0][code];
|
| 1954 |
-
|
| 1955 |
-
$credentialsTax = Mage::getStoreConfig('mycustom_section/mycustom_taxcode_group');
|
| 1956 |
-
$TaxCodeSerialArr = $credentialsTax['mycustom_taxcode_rates'];
|
| 1957 |
-
|
| 1958 |
-
$unserielTaxVal = unserialize($TaxCodeSerialArr);
|
| 1959 |
-
|
| 1960 |
-
$TAXCODE_VAL = "";
|
| 1961 |
-
foreach($unserielTaxVal as $oldrate => $oldtaxcode)
|
| 1962 |
-
{
|
| 1963 |
-
if($resultSalesOrder[items][$j][tax_amount] == $oldtaxcode['rate'])
|
| 1964 |
-
{
|
| 1965 |
-
$TAXCODE_VAL = $oldtaxcode['taxcode'];
|
| 1966 |
-
}
|
| 1967 |
-
}
|
| 1968 |
|
| 1969 |
-
|
| 1970 |
-
|
|
|
|
| 1971 |
|
| 1972 |
-
|
| 1973 |
-
|
| 1974 |
-
$fixedAmountCharges = $resultSalesOrder[base_shipping_amount];
|
| 1975 |
-
|
| 1976 |
-
$productDescription = str_ireplace("&", "&", $resultProduct[name]);
|
| 1977 |
-
$categoryDescription = str_ireplace("&", "&", $resultCategory[name]);
|
| 1978 |
-
|
| 1979 |
-
$taxRate = ($resultSalesOrder[items][$j][tax_percent] == "")?'0.0000':$resultSalesOrder[items][$j][tax_percent];
|
| 1980 |
-
$taxAmount = ($resultSalesOrder[items][$j][tax_amount] == "")?'0.0000':$resultSalesOrder[items][$j][tax_amount];
|
| 1981 |
-
|
| 1982 |
-
$config_chargescode = $credentials['mycustom_sale_chargescode'];
|
| 1983 |
-
$xmlRequest .= "<saleItem>
|
| 1984 |
-
<itemNumber>".$ITEM_NUMBER."</itemNumber>
|
| 1985 |
-
<productCode>".$resultProduct[sku]."</productCode>
|
| 1986 |
-
<productDescription>".$productDescription."</productDescription>
|
| 1987 |
-
<categoryCode>".$updateCategoryCode."</categoryCode>
|
| 1988 |
-
<categoryDescription>".$categoryDescription."</categoryDescription>
|
| 1989 |
-
<price>".$resultSalesOrder[items][$j][price]."</price>
|
| 1990 |
-
<currencyCode>".$resultSalesOrder[order_currency_code]."</currencyCode>
|
| 1991 |
-
<quantity>".number_format($resultSalesOrder[items][$j][qty_invoiced])."</quantity>
|
| 1992 |
-
<unitOfMeasure>EA</unitOfMeasure>
|
| 1993 |
-
<finalAmount>".$TotalfinalAmount."</finalAmount>
|
| 1994 |
-
<saleItemTaxes>
|
| 1995 |
-
<saleItemTax>
|
| 1996 |
-
<saleItemTaxNo>1</saleItemTaxNo>
|
| 1997 |
-
<taxCode>".$TAXCODE_VAL."</taxCode>
|
| 1998 |
-
<baseAmount>".$resultSalesOrder[base_tax_amount]."</baseAmount>
|
| 1999 |
-
<currencyCode>".$resultSalesOrder[order_currency_code]."</currencyCode>
|
| 2000 |
-
<taxRate>".$taxRate."</taxRate>
|
| 2001 |
-
<taxAmount>".$taxAmount."</taxAmount>
|
| 2002 |
-
</saleItemTax>
|
| 2003 |
-
</saleItemTaxes>
|
| 2004 |
-
<saleItemCharges>
|
| 2005 |
-
<saleItemCharge>
|
| 2006 |
-
<saleItemChargeNo>".$ITEM_NUMBER."</saleItemChargeNo>
|
| 2007 |
-
<chargeCode>".$config_chargescode."</chargeCode>
|
| 2008 |
-
<chargeDescription>".$resultSalesOrder[shipping_description]."</chargeDescription>
|
| 2009 |
-
<level>1</level>
|
| 2010 |
-
<type>2</type>
|
| 2011 |
-
<fixedAmountCurrency>".$resultSalesOrder[order_currency_code]."</fixedAmountCurrency>
|
| 2012 |
-
<fixedAmount>".$fixedAmountCharges."</fixedAmount>
|
| 2013 |
-
<baseAmount>".$resultSalesOrder[items][$j][base_row_total]."</baseAmount>
|
| 2014 |
-
<baseAmountCurrency>".$resultSalesOrder[order_currency_code]."</baseAmountCurrency>
|
| 2015 |
-
<amount>".$saleItemChargeAmt."</amount>
|
| 2016 |
-
</saleItemCharge>
|
| 2017 |
-
</saleItemCharges>
|
| 2018 |
-
</saleItem>";
|
| 2019 |
-
}
|
| 2020 |
-
|
| 2021 |
-
$credentialsPayCode = Mage::getStoreConfig('mycustom_section/mycustom_payment_group');
|
| 2022 |
-
$PayCodeSerialArr = $credentialsPayCode['mycustom_payment_checkmethod'];
|
| 2023 |
|
| 2024 |
-
$
|
| 2025 |
|
| 2026 |
-
$
|
| 2027 |
-
foreach($
|
| 2028 |
{
|
| 2029 |
-
if($resultSalesOrder[
|
| 2030 |
{
|
| 2031 |
-
$
|
| 2032 |
}
|
| 2033 |
}
|
| 2034 |
|
| 2035 |
-
if($
|
| 2036 |
-
$
|
| 2037 |
-
|
| 2038 |
-
$
|
| 2039 |
-
|
| 2040 |
-
|
| 2041 |
-
|
| 2042 |
-
|
| 2043 |
-
|
| 2044 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2045 |
<currencyCode>".$resultSalesOrder[order_currency_code]."</currencyCode>
|
| 2046 |
-
|
| 2047 |
-
|
| 2048 |
-
|
| 2049 |
-
|
| 2050 |
-
|
| 2051 |
-
|
| 2052 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2053 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2054 |
}
|
| 2055 |
-
|
| 2056 |
-
|
| 2057 |
-
|
| 2058 |
if($i == count($resultOrderList)-1 && $xmlRequest !="")
|
| 2059 |
{
|
| 2060 |
$xmlRequest .= "</inbound>";
|
|
@@ -2071,7 +2247,12 @@ function ExportOrderData()
|
|
| 2071 |
$flag = $e->getMessage();
|
| 2072 |
$responeXml = "fail";
|
| 2073 |
}
|
| 2074 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2075 |
|
| 2076 |
return $responeXml;
|
| 2077 |
}
|
|
@@ -2087,18 +2268,19 @@ function ExportCustomerData()
|
|
| 2087 |
$enterprise_code = '';
|
| 2088 |
|
| 2089 |
$soap = new SoapClient($mage_url);
|
| 2090 |
-
$sessionId
|
| 2091 |
|
| 2092 |
Mage::log('Customer data Export started ......', null, './Bluestore_customer_post.log.text');
|
| 2093 |
|
|
|
|
|
|
|
|
|
|
| 2094 |
try
|
| 2095 |
{
|
| 2096 |
$doc = new DOMDocument();
|
| 2097 |
$varpath = dirname(dirname(dirname(__FILE__)));
|
| 2098 |
$xmlFile = "$varpath/etc/config.xml";
|
| 2099 |
$doc->load($xmlFile);
|
| 2100 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 2101 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 2102 |
|
| 2103 |
$resultCustomer = $connection->query("select id,loopCounter,loopIteration from ".$prefix."bluefish_cron_schedule WHERE cronPath = 'mycustom_section/mycustom_customer_group/mycustom_customer_commonschedule'");
|
| 2104 |
$resultCustomerIteration = $resultCustomer->fetchAll(PDO::FETCH_ASSOC);
|
|
@@ -2108,6 +2290,7 @@ function ExportCustomerData()
|
|
| 2108 |
$credentials = Mage::getStoreConfig('mycustom_section/mycustom_customer_group');
|
| 2109 |
$commonschedule_Customer = $credentials['mycustom_customer_commonschedule'];
|
| 2110 |
$unserielCustomerVal = unserialize($commonschedule_Customer);
|
|
|
|
| 2111 |
|
| 2112 |
$CustomerCount = 0;
|
| 2113 |
|
|
@@ -2120,7 +2303,7 @@ function ExportCustomerData()
|
|
| 2120 |
}
|
| 2121 |
if($CustomerIterationCounter == $CustomerCounterDB)
|
| 2122 |
{
|
| 2123 |
-
$counterDB
|
| 2124 |
$Hourcronconfig = $FirstValHour;
|
| 2125 |
$Minutecronconfig = $FirstValMinute;
|
| 2126 |
}
|
|
@@ -2150,11 +2333,24 @@ function ExportCustomerData()
|
|
| 2150 |
$doc->saveXML();
|
| 2151 |
$doc->save($xmlFile);
|
| 2152 |
|
| 2153 |
-
|
| 2154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2155 |
#echo "<pre>";
|
| 2156 |
#print_r($customerList);
|
| 2157 |
#exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2158 |
for($i=0;$i<count($customerList);$i++)
|
| 2159 |
{
|
| 2160 |
$result = $connection->query("SELECT id,customer_code FROM ".$prefix."bluefish_customer WHERE customer_id = '".$customerList[$i][customer_id]."'");
|
|
@@ -2162,73 +2358,326 @@ function ExportCustomerData()
|
|
| 2162 |
$resultSet = $result->fetchAll(PDO::FETCH_ASSOC);
|
| 2163 |
$numberRows = count($resultSet);
|
| 2164 |
|
| 2165 |
-
|
| 2166 |
-
|
| 2167 |
-
|
| 2168 |
-
|
| 2169 |
-
|
| 2170 |
-
|
| 2171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2172 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2173 |
|
| 2174 |
-
|
| 2175 |
-
|
| 2176 |
-
|
| 2177 |
-
|
| 2178 |
-
|
| 2179 |
-
|
| 2180 |
-
|
| 2181 |
-
|
| 2182 |
-
|
| 2183 |
-
|
| 2184 |
-
|
| 2185 |
-
|
| 2186 |
-
|
| 2187 |
-
|
| 2188 |
-
|
| 2189 |
-
|
| 2190 |
-
|
| 2191 |
-
|
| 2192 |
-
|
| 2193 |
-
|
| 2194 |
-
|
| 2195 |
-
|
| 2196 |
-
|
| 2197 |
-
|
| 2198 |
-
|
| 2199 |
-
|
| 2200 |
-
|
| 2201 |
-
|
| 2202 |
-
|
| 2203 |
-
|
| 2204 |
-
|
| 2205 |
-
|
| 2206 |
-
|
| 2207 |
-
|
| 2208 |
-
|
| 2209 |
-
|
| 2210 |
-
|
| 2211 |
-
|
| 2212 |
-
|
| 2213 |
-
|
| 2214 |
-
|
| 2215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2216 |
|
|
|
|
|
|
|
| 2217 |
|
| 2218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2219 |
{
|
| 2220 |
-
$
|
| 2221 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2222 |
|
| 2223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2224 |
{
|
| 2225 |
-
$
|
| 2226 |
-
|
| 2227 |
-
|
| 2228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2229 |
$zz++;
|
| 2230 |
}
|
| 2231 |
-
Mage::log('
|
| 2232 |
|
| 2233 |
if($xmlRequest == "")
|
| 2234 |
$xmlRequest = "Exist";
|
|
@@ -2237,11 +2686,18 @@ function ExportCustomerData()
|
|
| 2237 |
}
|
| 2238 |
catch(Exception $e)
|
| 2239 |
{
|
| 2240 |
-
Mage::log('
|
| 2241 |
$flag = $e->getMessage();
|
| 2242 |
$responeXml = "fail";
|
| 2243 |
}
|
| 2244 |
-
|
| 2245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2246 |
}
|
| 2247 |
?>
|
| 120 |
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopIteration= '".$counterDB."' where id = '".$resultProductIteration[0][id]."'");
|
| 121 |
|
| 122 |
$markers=$doc->getElementsByTagName('bluefish_connection_product');
|
| 123 |
+
$markersexport=$doc->getElementsByTagName('bluefish_connection_productexport');
|
| 124 |
+
|
| 125 |
+
foreach ($markersexport as $marker)
|
| 126 |
+
{
|
| 127 |
+
$type=$marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $Product_cron_schedule_time;
|
| 128 |
+
}
|
| 129 |
foreach ($markers as $marker)
|
| 130 |
{
|
| 131 |
$marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $Product_cron_schedule_time;
|
| 159 |
$categoryIterationCounter = $resultCategoryIteration[0]['loopCounter'];
|
| 160 |
$categoryCounterDB = $resultCategoryIteration[0]['loopIteration'];
|
| 161 |
|
| 162 |
+
$credentials = Mage::getStoreConfig('mycustom_section/mycustom_category_group');
|
| 163 |
$commonschedule_category = $credentials['mycustom_category_defaultminuteschedule'];
|
| 164 |
$unserielCategoryVal = unserialize($commonschedule_category);
|
| 165 |
|
| 370 |
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
| 371 |
$xmlData = $xmlObj->getNode();
|
| 372 |
|
| 373 |
+
/*$mageFilename = $appBaseDir.'/app/Mage.php';
|
| 374 |
require_once $mageFilename;
|
| 375 |
Mage::setIsDeveloperMode(true);
|
| 376 |
|
| 377 |
umask(0);
|
| 378 |
Mage::app('admin');
|
| 379 |
Mage::register('isSecureArea', 1);
|
| 380 |
+
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);*/
|
| 381 |
|
| 382 |
Mage::log('Stock Import started ......', null, './Bluestore_stock.log.text');
|
| 383 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 384 |
|
| 385 |
$updatesversionVal = array();
|
| 386 |
|
| 472 |
$ErrorMsg .= "$count > Error:: while Upating Qty ($quantity) of Sku ($productCode) => ".$e->getMessage().":";
|
| 473 |
Mage::log("$count > Error:: while Upating Qty ($quantity) of Sku ($productCode) => ".$e->getMessage()."", null, './Bluestore_stock.log.text');
|
| 474 |
}
|
|
|
|
|
|
|
|
|
|
| 475 |
}
|
| 476 |
$count++;
|
| 477 |
}
|
| 478 |
}
|
| 479 |
if(count($xmlData) > 0)
|
| 480 |
{
|
| 481 |
+
$versionVal = max($updatesversionVal);
|
| 482 |
+
Mage::getModel('core/config')->saveConfig('mycustom_section/mycustom_stock_group/mycustom_currentstockversion', $versionVal);
|
|
|
|
| 483 |
}
|
| 484 |
if($ErrorMsg != "")
|
| 485 |
{
|
| 486 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 487 |
$prefix = Mage::getConfig()->getTablePrefix();
|
| 488 |
$resultCronScheduleID = $connection->query("SELECT schedule_id FROM ".$prefix."cron_schedule WHERE job_code = 'bluefish_connection_stock' AND status = 'pending' ORDER BY schedule_id DESC LIMIT 1");
|
| 489 |
$resultSetScheduleID = $resultCronScheduleID->fetchAll(PDO::FETCH_OBJ);
|
| 513 |
$xmlPath = $appBaseDir.'/products_bluestore.xml';
|
| 514 |
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
| 515 |
$xmlData = $xmlObj->getNode();
|
| 516 |
+
|
| 517 |
$mage_url = Mage::getBaseUrl()."api/soap/?wsdl";
|
| 518 |
$credentials = Mage::getStoreConfig('mycustom_section/mycustom_auth_group');
|
| 519 |
|
| 525 |
|
| 526 |
Mage::log('Product Import started ......', null, './Bluestore_product.log.text');
|
| 527 |
|
| 528 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 529 |
$prefix = Mage::getConfig()->getTablePrefix();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
|
| 531 |
+
$credentialsProduct = Mage::getStoreConfig('mycustom_section/mycustom_product_group');
|
| 532 |
+
$productmappingFlag = $credentialsProduct['mycustom_product_mapping_direct'];
|
| 533 |
+
$unserielVal = unserialize($productmappingFlag);
|
|
|
|
| 534 |
|
| 535 |
+
$credentialsTaxclass = Mage::getStoreConfig('mycustom_section/mycustom_taxclass_group');
|
| 536 |
+
$taxClassSerialArr = $credentialsTaxclass['mycustom_taxclass_magento'];
|
| 537 |
|
| 538 |
+
$unserielTaxClass = unserialize($taxClassSerialArr);
|
| 539 |
|
| 540 |
if(count($xmlData) > 0)
|
| 541 |
{
|
| 570 |
|
| 571 |
if($Deletestatus == "false")
|
| 572 |
{
|
| 573 |
+
if($unserielVal['#{_id}']['Dbproductmapping'] == 'MappingProduct')
|
| 574 |
{
|
| 575 |
$result = $connection->query("select code,category_id from ".$prefix."bluefish_category WHERE code = '".$categoryCode."'");
|
| 576 |
$resultSet = $result->fetchAll(PDO::FETCH_ASSOC);
|
| 699 |
}
|
| 700 |
}
|
| 701 |
}
|
| 702 |
+
if($unserielVal['#{_id}']['Dbproductmapping'] == 'DirectProduct')
|
| 703 |
{
|
| 704 |
$resultDirect = $connection->query("select code,category_id from ".$prefix."bluefish_category WHERE code = '".$categoryCode."'");
|
| 705 |
$resultSetDirect = $resultDirect->fetchAll(PDO::FETCH_ASSOC);
|
| 720 |
catch(Exception $e)
|
| 721 |
{
|
| 722 |
$flag = $e->getMessage();
|
|
|
|
| 723 |
$returnmessage = $flag;
|
| 724 |
}
|
| 725 |
try
|
| 795 |
VALUES('','".$ScheduledID."','".$ErrorMsg."')");
|
| 796 |
}
|
| 797 |
}
|
| 798 |
+
$returnmessage = ($returnmessage != "")?$returnmessage:"success";
|
| 799 |
}
|
| 800 |
else
|
| 801 |
{
|
| 808 |
function insert_update_database()
|
| 809 |
{
|
| 810 |
set_time_limit(0);
|
| 811 |
+
$appBaseDir = Mage::getBaseDir();
|
| 812 |
$xmlPath = $appBaseDir.'/categories_bluefish.xml';
|
| 813 |
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
| 814 |
$xmlData = $xmlObj->getNode();
|
| 840 |
Mage::log('Category Import started ......', null, './Bluestore_category.log.text');
|
| 841 |
|
| 842 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 843 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 844 |
|
| 845 |
+
$credentialsCategory = Mage::getStoreConfig('mycustom_section/mycustom_category_group');
|
| 846 |
+
$categorymappingFlag = $credentialsCategory['mycustom_category_mapping_direct'];
|
| 847 |
+
$unserielVal = unserialize($categorymappingFlag);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 848 |
|
| 849 |
$rootCateogryId = Mage::app()->getStore('default')->getRootCategoryId();
|
| 850 |
function get_categories(){
|
| 1115 |
##### Function for Create/Update the magento customer
|
| 1116 |
function insert_update_database3()
|
| 1117 |
{
|
| 1118 |
+
$appBaseDir = Mage::getBaseDir();
|
| 1119 |
+
$xmlPath = $appBaseDir.'/customers_bluefish.xml';
|
| 1120 |
+
$xmlObj = new Varien_Simplexml_Config($xmlPath);
|
| 1121 |
+
$xmlData = $xmlObj->getNode();
|
| 1122 |
|
| 1123 |
+
$mage_url = Mage::getBaseUrl()."api/soap/?wsdl";
|
| 1124 |
+
$credentials = Mage::getStoreConfig('mycustom_section/mycustom_auth_group');
|
| 1125 |
|
| 1126 |
+
$mage_user = $credentials['mycustom_login'];
|
| 1127 |
+
$mage_api_key = $credentials['mycustom_password'];
|
| 1128 |
|
| 1129 |
+
$soap = new SoapClient($mage_url);
|
| 1130 |
+
$sessionId = $soap->login($mage_user, $mage_api_key);
|
| 1131 |
|
| 1132 |
+
Mage::log('Customer Import started ......', null, './Bluestore_customer.log.text');
|
| 1133 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1134 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 1135 |
+
|
| 1136 |
+
$updatesversionVal = array();
|
| 1137 |
+
|
| 1138 |
+
for($i=0;$i<count($xmlData);$i++)
|
| 1139 |
+
{
|
| 1140 |
+
$code = $xmlData->customer[$i]->code;
|
| 1141 |
+
$externalRef = $xmlData->customer[$i]->externalRef;
|
| 1142 |
+
$taxOrVatRef = $xmlData->customer[$i]->taxOrVatRef;
|
| 1143 |
+
$createdOn = $xmlData->customer[$i]->createdOn;
|
| 1144 |
+
$Addresscode = $xmlData->customer[$i]->address->code;
|
| 1145 |
+
$isCorresponden = $xmlData->customer[$i]->address->isCorrespondence;
|
| 1146 |
+
$isBilling = $xmlData->customer[$i]->address->isBilling;
|
| 1147 |
+
$isDelivery = $xmlData->customer[$i]->address->isDelivery;
|
| 1148 |
+
$title = $xmlData->customer[$i]->address->title;
|
| 1149 |
+
$firstName = $xmlData->customer[$i]->address->firstName;
|
| 1150 |
+
$lastName = $xmlData->customer[$i]->address->lastName;
|
| 1151 |
+
$companyName = $xmlData->customer[$i]->address->companyName;
|
| 1152 |
+
$street1 = $xmlData->customer[$i]->address->street1;
|
| 1153 |
+
$street2 = $xmlData->customer[$i]->address->street2;
|
| 1154 |
+
$street3 = $xmlData->customer[$i]->address->street3;
|
| 1155 |
+
$city = $xmlData->customer[$i]->address->city;
|
| 1156 |
+
$stateOrRegion = $xmlData->customer[$i]->address->stateOrRegion;
|
| 1157 |
+
$postalCode = $xmlData->customer[$i]->address->postalCode;
|
| 1158 |
+
$country = $xmlData->customer[$i]->address->country;
|
| 1159 |
+
$phone1 = $xmlData->customer[$i]->address->phone1;
|
| 1160 |
+
$phone2 = $xmlData->customer[$i]->address->phone2;
|
| 1161 |
+
$email = $xmlData->customer[$i]->address->email;
|
| 1162 |
|
| 1163 |
+
$version = $xmlData->customer[$i]->version;
|
| 1164 |
+
$updatesversionVal[] = "$version";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1165 |
|
| 1166 |
+
$result = $connection->query("SELECT id,customer_id,address_id FROM ".$prefix."bluefish_customer WHERE customer_code = '".$code."'");
|
|
|
|
|
|
|
|
|
|
| 1167 |
|
| 1168 |
+
$resultSet = $result->fetchAll(PDO::FETCH_ASSOC);
|
| 1169 |
+
$numberRows = count($resultSet);
|
| 1170 |
|
| 1171 |
+
if($numberRows == 0)
|
| 1172 |
+
{
|
| 1173 |
+
try
|
| 1174 |
{
|
| 1175 |
+
$customerID = $soap->call($sessionId,'customer.create',array(array('email' => "$email", 'firstname' => "$firstName", 'lastname' => "$lastName", 'prefix' => "$title", 'website_id' => 1, 'store_id' => 1, 'group_id' => 1,'created_at'=> "$createdOn")));
|
| 1176 |
+
$address_id = "";
|
|
|
|
|
|
|
| 1177 |
|
| 1178 |
+
if(($city != "") && ($postalCode !="") && ($phone1 != "") && ($street1 != ""))
|
| 1179 |
+
{
|
| 1180 |
+
try
|
| 1181 |
{
|
| 1182 |
+
$address_id = $soap->call($sessionId,'customer_address.create',array('customerId' => "$customerID", 'addressdata' => array('firstname' => "$firstName", 'lastname' => "$lastName", 'street' => array("$street1", "$street2", "$street3"), 'city' => "$city", 'country_id' => "$country", 'region' => "$stateOrRegion", 'region_id' => 3, 'postcode' => "$postalCode", 'telephone' => "$phone1", 'is_default_billing' => "$isBilling", 'is_default_shipping' => "$isDelivery", 'company' => "$companyName", 'prefix' => "$title")));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1183 |
}
|
| 1184 |
+
catch(Exception $e)
|
| 1185 |
{
|
| 1186 |
+
$flag = $e->getMessage();
|
| 1187 |
+
$ErrorMsg .= $firstName." ".$lastName." - ".$e->getMessage().":";
|
| 1188 |
+
$flag = "fail";
|
| 1189 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1190 |
}
|
| 1191 |
+
else
|
| 1192 |
{
|
| 1193 |
+
$ErrorMsg .= 'Customer ID '.$customerID.' - address not created. City, Postal Code, Phone Number OR Street address is blank.'.":";
|
| 1194 |
+
Mage::log('Customer : '.$customerID.' address not created. City, Postal Code, Phone Number OR Street address is blank.', null, './Bluestore_customer.log.text');
|
|
|
|
|
|
|
| 1195 |
}
|
| 1196 |
+
|
| 1197 |
+
$InsertCus = $connection->query("INSERT INTO ".$prefix."bluefish_customer(id,customer_id,address_id,customer_code,created_time,update_time)
|
| 1198 |
+
VALUES('','".$customerID."','".$address_id."','".$code."','".now()."','')");
|
| 1199 |
+
|
| 1200 |
+
Mage::log('Customer '.$customerID.' Created.', null, './Bluestore_customer.log.text');
|
| 1201 |
+
$flag = "success";
|
| 1202 |
}
|
| 1203 |
+
catch(Exception $e)
|
| 1204 |
{
|
| 1205 |
+
$flag = $e->getMessage();
|
| 1206 |
+
$ErrorMsg .= $firstName." ".$lastName." - ".$e->getMessage().":";
|
| 1207 |
+
Mage::log('Customer not created - '.$flag.'.', null, './Bluestore_customer.log.text');
|
| 1208 |
+
$flag = "Not Created";
|
| 1209 |
+
}
|
| 1210 |
+
}
|
| 1211 |
+
else
|
| 1212 |
+
{
|
| 1213 |
+
try
|
| 1214 |
+
{
|
| 1215 |
+
$customerIdForupadte = $resultSet[0]['customer_id'];
|
| 1216 |
+
$addressIdForupadte = $resultSet[0]['address_id'];
|
| 1217 |
|
| 1218 |
+
$customerUpdate = $soap->call($sessionId,'customer.update',array('customerId' => "$customerIdForupadte",'customerData' => array('email' => "$email", 'firstname' => "$firstName", 'lastname' => "$lastName", 'prefix' => "$title")));
|
| 1219 |
|
| 1220 |
+
if(($addressIdForupadte > 0) && ($city != "") && ($postalCode !="") && ($phone1 != "") && ($street1 != ""))
|
| 1221 |
+
{
|
| 1222 |
+
$soap->call($sessionId,'customer_address.update',array('addressId' => "$addressIdForupadte",'addressdata' => array('firstname' => "$firstName", 'lastname' => "$lastName", 'street' => array("$street1", "$street2", "$street3"), 'city' => "$city", 'country_id' => "$country", 'region' => "$stateOrRegion", 'postcode' => "$postalCode", 'telephone' => "$phone1", 'is_default_billing' => "$isBilling", 'is_default_shipping' => "$isDelivery", 'company' => "$companyName", 'prefix' => "$title")));
|
| 1223 |
+
}
|
| 1224 |
|
| 1225 |
+
$CustomerUpdate = $connection->query("UPDATE ".$prefix."bluefish_customer SET update_time= '".now()."' where customer_code = '".$code."'");
|
| 1226 |
|
| 1227 |
+
Mage::log('Customer '.$customerID.' Updated.', null, './Bluestore_customer.log.text');
|
| 1228 |
+
$flag = "success";
|
| 1229 |
+
}
|
| 1230 |
+
catch(Exception $e)
|
| 1231 |
+
{
|
| 1232 |
+
$flag = $e->getMessage();
|
| 1233 |
+
|
| 1234 |
+
if($flag == "Customer not exists.")
|
| 1235 |
{
|
| 1236 |
+
$result = $connection->query("delete from ".$prefix."bluefish_customer WHERE customer_code = '".$code."'");
|
| 1237 |
|
| 1238 |
+
try
|
| 1239 |
{
|
| 1240 |
+
$customerID = $soap->call($sessionId,'customer.create',array(array('email' => "$email", 'firstname' => "$firstName", 'lastname' => "$lastName", 'prefix' => "$title", 'website_id' => 1, 'store_id' => 1, 'group_id' => 1,'created_at'=> "$createdOn")));
|
| 1241 |
+
$address_id = "";
|
| 1242 |
|
| 1243 |
+
if(($city != "") && ($postalCode !="") && ($phone1 != "") && ($street1 != ""))
|
| 1244 |
{
|
| 1245 |
+
try
|
|
|
|
|
|
|
|
|
|
| 1246 |
{
|
| 1247 |
+
$address_id = $soap->call($sessionId,'customer_address.create',array('customerId' => "$customerID", 'addressdata' => array('firstname' => "$firstName", 'lastname' => "$lastName", 'street' => array("$street1", "$street2", "$street3"), 'city' => "$city", 'country_id' => "$country", 'region' => "$stateOrRegion", 'region_id' => 3, 'postcode' => "$postalCode", 'telephone' => "$phone1", 'is_default_billing' => "$isBilling", 'is_default_shipping' => "$isDelivery", 'company' => "$companyName", 'prefix' => "$title")));
|
| 1248 |
+
}
|
| 1249 |
+
catch(Exception $e)
|
| 1250 |
+
{
|
| 1251 |
+
$flag = $e->getMessage();
|
| 1252 |
+
$ErrorMsg .= $firstName." ".$lastName." - ".$e->getMessage().":";
|
| 1253 |
+
$flag = "fail";
|
|
|
|
|
|
|
|
|
|
| 1254 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1255 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1256 |
|
| 1257 |
+
$InsertCus = $connection->query("INSERT INTO ".$prefix."bluefish_customer(id,customer_id,address_id,customer_code,created_time,update_time)
|
| 1258 |
+
VALUES('','".$customerID."','".$address_id."','".$code."','".now()."','')");
|
| 1259 |
+
|
| 1260 |
+
Mage::log('Customer '.$customerID.' Created.', null, './Bluestore_customer.log.text');
|
| 1261 |
+
$flag = "success";
|
| 1262 |
}
|
| 1263 |
+
catch(Exception $e)
|
| 1264 |
{
|
| 1265 |
+
$flag = $e->getMessage();
|
| 1266 |
+
$ErrorMsg .= $firstName." ".$lastName." - ".$e->getMessage().":";
|
| 1267 |
+
Mage::log('Customer '.$customerID.' not created.', null, './Bluestore_customer.log.text');
|
| 1268 |
+
|
| 1269 |
+
$flag = "Not Created";
|
| 1270 |
}
|
| 1271 |
}
|
| 1272 |
+
else
|
| 1273 |
+
{
|
| 1274 |
+
Mage::log('Customer '.$customerID.' not updated.', null, './Bluestore_customer.log.text');
|
| 1275 |
+
$ErrorMsg .= 'Customer '.$customerID.' not updated.'.":";
|
| 1276 |
+
$flag = "fail";
|
| 1277 |
+
}
|
| 1278 |
}
|
| 1279 |
}
|
| 1280 |
+
}
|
| 1281 |
+
if($ErrorMsg != "")
|
| 1282 |
+
{
|
| 1283 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1284 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 1285 |
+
$resultCronScheduleID = $connection->query("SELECT schedule_id FROM ".$prefix."cron_schedule WHERE job_code = 'bluefish_connection_customer' AND status = 'pending' ORDER BY schedule_id DESC LIMIT 1");
|
| 1286 |
+
$resultSetScheduleID = $resultCronScheduleID->fetchAll(PDO::FETCH_OBJ);
|
| 1287 |
+
|
| 1288 |
+
$ScheduledID = $resultSetScheduleID[0]->schedule_id;
|
| 1289 |
+
$numberRows = count($resultSetScheduleID);
|
| 1290 |
+
|
| 1291 |
+
if($numberRows > 0)
|
| 1292 |
{
|
| 1293 |
+
$ErrorMsg = addslashes($ErrorMsg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1294 |
|
| 1295 |
+
$connection->query("INSERT INTO ".$prefix."bluefish_cron_schedule_logs(id,schedule_id,error)
|
| 1296 |
+
VALUES('','".$ScheduledID."','".$ErrorMsg."')");
|
| 1297 |
+
}
|
| 1298 |
+
}
|
| 1299 |
+
if(count($updatesversionVal) > 0)
|
| 1300 |
+
{
|
| 1301 |
+
$versionVal = max($updatesversionVal);
|
| 1302 |
+
Mage::getModel('core/config')->saveConfig('mycustom_section/mycustom_customer_group/mycustom_bluestore_customer_version', $versionVal);
|
| 1303 |
+
}
|
| 1304 |
+
return $flag;
|
| 1305 |
}
|
| 1306 |
|
| 1307 |
##### Function for import Bluestore sales
|
| 1308 |
+
function importBluestoreSales($transactionNumber)
|
| 1309 |
{
|
| 1310 |
$appBaseDir = Mage::getBaseDir();
|
| 1311 |
$xmlPath = $appBaseDir.'/sales_bluestore_import.xml';
|
| 1321 |
$soap = new SoapClient($mage_url);
|
| 1322 |
$sessionId = $soap->login($mage_user, $mage_api_key);
|
| 1323 |
|
| 1324 |
+
$credentials_sales = Mage::getStoreConfig('mycustom_section/mycustom_sales_import_group');
|
| 1325 |
$guestCustomerCode = $credentials_sales['mycustom_customer_idimport'];
|
| 1326 |
|
| 1327 |
Mage::log('Sales Import started ......', null, './Bluestore_sales_import.log.text');
|
| 1329 |
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 1330 |
$prefix = Mage::getConfig()->getTablePrefix();
|
| 1331 |
|
| 1332 |
+
$credentialsSales = Mage::getStoreConfig('mycustom_section/mycustom_sales_import_group');
|
| 1333 |
+
$salesmappingFlag = $credentialsSales['mycustom_sales_mapping_method'];
|
| 1334 |
+
$unserielVal = unserialize($salesmappingFlag);
|
| 1335 |
+
|
| 1336 |
for($i=0;$i<count($xmlData);$i++)
|
| 1337 |
{
|
| 1338 |
$error = "";
|
| 1339 |
+
$firstname = "";
|
| 1340 |
+
$lastname = "";
|
| 1341 |
+
$company = "";
|
| 1342 |
+
$street = "";
|
| 1343 |
+
$city = "";
|
| 1344 |
+
$region = "";
|
| 1345 |
+
$postcode = "";
|
| 1346 |
+
$country_id = "";
|
| 1347 |
+
$telephone = "";
|
| 1348 |
+
$email = "";
|
| 1349 |
+
$customerMagento = "";
|
| 1350 |
+
$customerGuest = "";
|
| 1351 |
+
$arrAddresses = array();
|
| 1352 |
+
$customer = array();
|
| 1353 |
+
$customerCode = "";
|
| 1354 |
+
$adjustment_negative = "";
|
| 1355 |
+
$arrQtyRefund = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1356 |
|
| 1357 |
+
$customerCode = $xmlData->sale[$i]->customer->customerCode;
|
| 1358 |
+
$transactionCode = $xmlData->sale[$i]->transactionCode;
|
|
|
|
| 1359 |
|
| 1360 |
+
$resultInvoiceComment = $connection->query("select entity_id from ".$prefix."sales_flat_invoice_comment WHERE comment like '%".$transactionCode."%'");
|
| 1361 |
+
$resultSetInvoice = $resultInvoiceComment->fetchAll(PDO::FETCH_ASSOC);
|
| 1362 |
+
$numberInvoiceComment = count($resultSetInvoice);
|
| 1363 |
+
|
| 1364 |
+
if($numberInvoiceComment == 0)
|
| 1365 |
+
{
|
| 1366 |
+
for($p=0;$p<count($xmlData->sale[$i]->items->item);$p++){
|
| 1367 |
+
|
| 1368 |
+
if($unserielVal['#{_id}']['Salemapping'] == 'Productcode')
|
|
|
|
| 1369 |
{
|
| 1370 |
+
$productCodeBluestore = $xmlData->sale[$i]->items->item[$p]->productCode;
|
| 1371 |
+
try{
|
| 1372 |
+
$magentoProductIdCheck = Mage::getModel("catalog/product")->getIdBySku($productCodeBluestore);
|
| 1373 |
+
|
| 1374 |
+
if($magentoProductIdCheck == "")
|
| 1375 |
+
{
|
| 1376 |
+
$error .= "Product SKU => $productCodeBluestore does not exist in magento. <br>";
|
| 1377 |
+
}
|
| 1378 |
+
}catch(Exception $e){
|
| 1379 |
+
|
| 1380 |
+
}
|
| 1381 |
}
|
| 1382 |
+
else
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1383 |
{
|
| 1384 |
+
$productCodeBluestore = $xmlData->sale[$i]->items->item[$p]->productCode;
|
| 1385 |
+
try{
|
| 1386 |
+
$product = Mage::getModel('catalog/product')->load($productCodeBluestore);
|
| 1387 |
+
|
| 1388 |
+
if (!$product->getId()) {
|
| 1389 |
+
$error .= "Product SKU => $productCodeBluestore does not exist in magento. <br>";
|
| 1390 |
+
}
|
| 1391 |
+
}catch(Exception $e){
|
| 1392 |
+
|
| 1393 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1394 |
}
|
| 1395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1396 |
}
|
| 1397 |
|
| 1398 |
+
$errorNum = 0;
|
| 1399 |
+
$arrProducts = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1400 |
|
| 1401 |
+
$paymentMethod = $xmlData->sale[$i]->payments->payment->tenderType;
|
| 1402 |
+
$updateLastDateArr[] = $xmlData->sale[$i]->endDate." ".$xmlData->sale[$i]->timezoneId;
|
| 1403 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1404 |
|
| 1405 |
+
$resultFailureorder = $connection->query("select sale_code from ".$prefix."bluefish_import_error_logs WHERE sale_code ='".$transactionCode."'");
|
| 1406 |
+
$resultSetFailureorder = $resultFailureorder->fetchAll(PDO::FETCH_ASSOC);
|
| 1407 |
+
$numberFailureorder = count($resultSetFailureorder);
|
|
|
|
|
|
|
|
|
|
| 1408 |
|
| 1409 |
+
if($error == "")
|
| 1410 |
+
{
|
| 1411 |
+
for($j=0;$j<count($xmlData->sale[$i]->items->item);$j++){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1412 |
|
| 1413 |
+
$productCode = $xmlData->sale[$i]->items->item[$j]->productCode;
|
| 1414 |
+
$quantity_item = $xmlData->sale[$i]->items->item[$j]->quantity;
|
| 1415 |
+
$quantity_item = (int)$quantity_item;
|
|
|
|
|
|
|
| 1416 |
|
| 1417 |
+
if($unserielVal['#{_id}']['Salemapping'] == 'Productcode')
|
| 1418 |
+
{
|
| 1419 |
+
$magentoProductId = Mage::getModel("catalog/product")->getIdBySku($productCode);
|
| 1420 |
+
}
|
| 1421 |
+
else{
|
| 1422 |
+
$magentoProductId = $productCode;
|
| 1423 |
+
}
|
| 1424 |
|
| 1425 |
+
$arrProducts[$j] = array(
|
| 1426 |
+
'product_id' => "$magentoProductId",
|
| 1427 |
+
'quantity' => "$quantity_item"
|
| 1428 |
+
);
|
|
|
|
| 1429 |
|
| 1430 |
+
#### Only For Adjust Credit Memo Quantity
|
| 1431 |
+
if (!is_int($quantity_item) || $quantity_item < 1) {
|
| 1432 |
+
$arrQtyRefund = array("$magentoProductId" => $quantity_item);
|
| 1433 |
+
}
|
| 1434 |
+
}
|
| 1435 |
+
|
| 1436 |
+
try{
|
| 1437 |
+
$shoppingCartIncrementId = $soap->call( $sessionId, 'cart.create');
|
| 1438 |
+
}
|
| 1439 |
+
catch(Exception $e){
|
| 1440 |
+
$error .= $e->getMessage()."<br>";
|
| 1441 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1442 |
|
| 1443 |
+
if($error == "") ### checking when there is no error in creating shopping cart
|
| 1444 |
+
{
|
| 1445 |
+
try{
|
| 1446 |
+
$resultCartProductAdd = $soap->call(
|
| 1447 |
+
$sessionId,
|
| 1448 |
+
"cart_product.add",
|
| 1449 |
+
array(
|
| 1450 |
+
$shoppingCartIncrementId,
|
| 1451 |
+
$arrProducts
|
| 1452 |
+
)
|
| 1453 |
+
);
|
| 1454 |
+
}
|
| 1455 |
+
catch(Exception $e){
|
| 1456 |
+
$error .= $e->getMessage()."<br>";
|
| 1457 |
+
}
|
| 1458 |
+
|
| 1459 |
+
if($error == "") ### checking when there is no error adding product into shopping cart
|
| 1460 |
+
{
|
| 1461 |
+
$shoppingCartId = $shoppingCartIncrementId;
|
| 1462 |
+
|
| 1463 |
+
if ($customerCode == "") {
|
| 1464 |
+
$customerGuest = Mage::getModel('customer/customer')->load($guestCustomerCode);
|
| 1465 |
+
$customerAddress = array();
|
| 1466 |
|
| 1467 |
+
foreach ($customerGuest->getAddresses() as $address)
|
| 1468 |
+
{
|
| 1469 |
+
$customerAddress = $address->toArray();
|
| 1470 |
+
}
|
| 1471 |
+
|
| 1472 |
+
$firstname = $customerAddress[firstname];
|
| 1473 |
+
$lastname = $customerAddress[lastname];
|
| 1474 |
+
$company = $customerAddress[company];
|
| 1475 |
+
$street = $customerAddress[street];
|
| 1476 |
+
$city = $customerAddress[city];
|
| 1477 |
+
$region = $customerAddress[region];
|
| 1478 |
+
$postcode = $customerAddress[postcode];
|
| 1479 |
+
$country_id = $customerAddress[country_id];
|
| 1480 |
+
$telephone = $customerAddress[telephone];
|
| 1481 |
+
$email = $customerGuest->getEmail();
|
| 1482 |
+
|
| 1483 |
+
$customer = array(
|
| 1484 |
+
"firstname" => $firstname,
|
| 1485 |
+
"lastname" => $lastname,
|
| 1486 |
+
"website_id" => "1",
|
| 1487 |
+
"group_id" => "1",
|
| 1488 |
+
"store_id" => "1",
|
| 1489 |
+
"email" => $email,
|
| 1490 |
+
"mode" => "guest",
|
| 1491 |
+
);
|
| 1492 |
+
}
|
| 1493 |
+
else{
|
| 1494 |
+
$resultCustomerExist = $connection->query("select customer_id from ".$prefix."bluefish_customer WHERE customer_code ='".$customerCode."'");
|
| 1495 |
+
$customerExistDbID = $resultCustomerExist->fetchAll(PDO::FETCH_ASSOC);
|
| 1496 |
+
$customerExtingNum = count($customerExistDbID);
|
| 1497 |
+
$customerID = "";
|
| 1498 |
+
|
| 1499 |
+
if($customerExtingNum > 0)
|
| 1500 |
+
{
|
| 1501 |
+
$customerMagento = Mage::getModel('customer/customer')->load($customerExistDbID[0][customer_id]);
|
| 1502 |
+
$customerAddressMagento = array();
|
| 1503 |
+
|
| 1504 |
+
foreach ($customerMagento->getAddresses() as $addressMagento)
|
| 1505 |
+
{
|
| 1506 |
+
$customerAddressMagento = $addressMagento->toArray();
|
| 1507 |
+
}
|
| 1508 |
+
|
| 1509 |
+
$firstname = $customerAddressMagento[firstname];
|
| 1510 |
+
$lastname = $customerAddressMagento[lastname];
|
| 1511 |
+
$company = $customerAddressMagento[company];
|
| 1512 |
+
$street = $customerAddressMagento[street];
|
| 1513 |
+
$city = $customerAddressMagento[city];
|
| 1514 |
+
$region = $customerAddressMagento[region];
|
| 1515 |
+
$postcode = $customerAddressMagento[postcode];
|
| 1516 |
+
$country_id = $customerAddressMagento[country_id];
|
| 1517 |
+
$telephone = $customerAddressMagento[telephone];
|
| 1518 |
+
$email = $customerMagento->getEmail();
|
| 1519 |
+
|
| 1520 |
+
|
| 1521 |
+
$customer = array(
|
| 1522 |
+
"customer_id" => $customerExistDbID[0][customer_id],
|
| 1523 |
+
"website_id" => "1",
|
| 1524 |
+
"group_id" => "1",
|
| 1525 |
+
"store_id" => "1",
|
| 1526 |
+
"mode" => "customer",
|
| 1527 |
+
);
|
| 1528 |
+
}
|
| 1529 |
+
else{
|
| 1530 |
+
|
| 1531 |
+
if(!empty($xmlData->sale[$i]->customer->title)){
|
| 1532 |
+
$title = (string)$xmlData->sale[$i]->customer->title;
|
| 1533 |
+
$title = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $title);
|
| 1534 |
+
}
|
| 1535 |
+
if(!empty($xmlData->sale[$i]->customer->firstName)){
|
| 1536 |
+
$firstname = (string)$xmlData->sale[$i]->customer->firstName;
|
| 1537 |
+
$firstname = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $firstname);
|
| 1538 |
+
}
|
| 1539 |
+
if(!empty($xmlData->sale[$i]->customer->lastName)){
|
| 1540 |
+
$lastname = (string)$xmlData->sale[$i]->customer->lastName;
|
| 1541 |
+
$lastname = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $lastname);
|
| 1542 |
+
}
|
| 1543 |
+
if(!empty($xmlData->sale[$i]->customer->countryCode)){
|
| 1544 |
+
$country_id = (string)$xmlData->sale[$i]->customer->countryCode;
|
| 1545 |
+
$country_id = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $country_id);
|
| 1546 |
+
}
|
| 1547 |
+
if(!empty($xmlData->sale[$i]->customer->email)){
|
| 1548 |
+
$email = (string)$xmlData->sale[$i]->customer->email;
|
| 1549 |
+
$email = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $email);
|
| 1550 |
+
}
|
| 1551 |
+
if(!empty($xmlData->sale[$i]->customer->postalZipCode)){
|
| 1552 |
+
$postcode = (string)$xmlData->sale[$i]->customer->postalZipCode;
|
| 1553 |
+
$postcode = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $postcode);
|
| 1554 |
+
}
|
| 1555 |
+
if(!empty($xmlData->sale[$i]->customer->stateRegion)){
|
| 1556 |
+
$region = (string)$xmlData->sale[$i]->customer->stateRegion;
|
| 1557 |
+
$region = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $region);
|
| 1558 |
+
}
|
| 1559 |
+
if(!empty($xmlData->sale[$i]->customer->street1)){
|
| 1560 |
+
$street1 = (string)$xmlData->sale[$i]->customer->street1;
|
| 1561 |
+
$street1 = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $street1);
|
| 1562 |
+
}
|
| 1563 |
+
if(!empty($xmlData->sale[$i]->customer->street2)){
|
| 1564 |
+
$street2 = (string)$xmlData->sale[$i]->customer->street2;
|
| 1565 |
+
$street2 = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $street2);
|
| 1566 |
+
}
|
| 1567 |
+
if(!empty($xmlData->sale[$i]->customer->street3)){
|
| 1568 |
+
$street3 = (string)$xmlData->sale[$i]->customer->street3;
|
| 1569 |
+
$street3 = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $street3);
|
| 1570 |
+
}
|
| 1571 |
+
if(!empty($xmlData->sale[$i]->customer->telephone1)){
|
| 1572 |
+
$telephone = (string)$xmlData->sale[$i]->customer->telephone1;
|
| 1573 |
+
$telephone = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $telephone);
|
| 1574 |
+
}
|
| 1575 |
+
if(!empty($xmlData->sale[$i]->customer->townCity)){
|
| 1576 |
+
$city = (string)$xmlData->sale[$i]->customer->townCity;
|
| 1577 |
+
$city = str_replace(array('&', '"', "'", '<', '>'), array('&', '"', ''', '<', '>'), $city);
|
| 1578 |
+
}
|
| 1579 |
+
|
| 1580 |
+
$street = $street1;
|
| 1581 |
+
|
| 1582 |
+
if($street2 != ""){
|
| 1583 |
+
$street .= " ".$street2;
|
| 1584 |
+
}
|
| 1585 |
+
if($street3 != ""){
|
| 1586 |
+
$street .= " ".$street3;
|
| 1587 |
+
}
|
| 1588 |
+
|
| 1589 |
+
$customercreatedOn = date("Y-m-d");
|
| 1590 |
+
$isBilling = "true";
|
| 1591 |
+
$isDelivery = "true";
|
| 1592 |
+
$flagBluestore = "";
|
| 1593 |
+
|
| 1594 |
+
try
|
| 1595 |
+
{
|
| 1596 |
+
$customerID = $soap->call($sessionId,'customer.create',array(array('email' => "$email", 'firstname' => "$firstname", 'lastname' => "$lastname", 'prefix' => "$title", 'website_id' => 1, 'store_id' => 1, 'group_id' => 1,'created_at'=> "$customercreatedOn")));
|
| 1597 |
+
}
|
| 1598 |
+
catch(Exception $e)
|
| 1599 |
+
{
|
| 1600 |
+
$flagBluestore = "fail";
|
| 1601 |
+
$error .= $e->getMessage()."<br>";
|
| 1602 |
+
}
|
| 1603 |
+
if($customerID !="")
|
| 1604 |
+
{
|
| 1605 |
+
$address_id = "";
|
| 1606 |
+
|
| 1607 |
+
if(($city != "") && ($postcode !="") && ($telephone != "") && ($street != ""))
|
| 1608 |
+
{
|
| 1609 |
+
try
|
| 1610 |
+
{
|
| 1611 |
+
$address_id = $soap->call($sessionId,'customer_address.create',array('customerId' => "$customerID", 'addressdata' => array('firstname' => "$firstname", 'lastname' => "$lastname", 'street' => array("$street1", "$street2", "$street3"), 'city' => "$city", 'country_id' => "$country_id", 'region' => "$region", 'region_id' => 3, 'postcode' => "$postcode", 'telephone' => "$telephone", 'is_default_billing' => "$isBilling", 'is_default_shipping' => "$isDelivery", 'company' => "", 'prefix' => "$title")));
|
| 1612 |
+
}
|
| 1613 |
+
catch(Exception $e)
|
| 1614 |
+
{
|
| 1615 |
+
$ErrorMsg = $firstname." ".$lastname." - ".$e->getMessage().":";
|
| 1616 |
+
Mage::log('Customer not Created. Error =>'.$ErrorMsg, null, './Bluestore_customer.log.text');
|
| 1617 |
+
}
|
| 1618 |
+
}
|
| 1619 |
+
}
|
| 1620 |
+
if($flagBluestore == "" && $customerID != "")
|
| 1621 |
+
{
|
| 1622 |
+
$InsertCus = $connection->query("INSERT INTO ".$prefix."bluefish_customer(id,customer_id,address_id,customer_code,created_time,update_time)
|
| 1623 |
+
VALUES('','".$customerID."','".$address_id."','".$customerCode."','".now()."','')");
|
| 1624 |
+
|
| 1625 |
+
$customer = array(
|
| 1626 |
+
"customer_id" => $customerID,
|
| 1627 |
+
"website_id" => "1",
|
| 1628 |
+
"group_id" => "1",
|
| 1629 |
+
"store_id" => "1",
|
| 1630 |
+
"mode" => "customer",
|
| 1631 |
+
);
|
| 1632 |
+
}
|
| 1633 |
+
}
|
| 1634 |
+
|
| 1635 |
+
}
|
| 1636 |
+
|
| 1637 |
+
try{
|
| 1638 |
+
$resultCustomerSet = $soap->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customer) );
|
| 1639 |
+
}
|
| 1640 |
+
catch(Exception $e){
|
| 1641 |
+
$error .= "Customer record not set with the sale"."<br>";
|
| 1642 |
+
}
|
| 1643 |
+
|
| 1644 |
+
if($error == "") ### checking when there is no error set customer record for shopping cart
|
| 1645 |
+
{
|
| 1646 |
+
// Set customer addresses, for example guest's addresses
|
| 1647 |
+
$arrAddresses = array(
|
| 1648 |
+
array(
|
| 1649 |
+
"mode" => "shipping",
|
| 1650 |
+
"firstname" => $firstname,
|
| 1651 |
+
"lastname" => $lastname,
|
| 1652 |
+
"company" => $company,
|
| 1653 |
+
"street" => $street,
|
| 1654 |
+
"city" => $city,
|
| 1655 |
+
"region" => $region,
|
| 1656 |
+
"postcode" => $postcode,
|
| 1657 |
+
"country_id" => $country_id,
|
| 1658 |
+
"telephone" => "$telephone",
|
| 1659 |
+
"is_default_shipping" => 0,
|
| 1660 |
+
"is_default_billing" => 0
|
| 1661 |
+
),
|
| 1662 |
+
array(
|
| 1663 |
+
"mode" => "billing",
|
| 1664 |
+
"firstname" => $firstname,
|
| 1665 |
+
"lastname" => $lastname,
|
| 1666 |
+
"company" => $company,
|
| 1667 |
+
"street" => $street,
|
| 1668 |
+
"city" => $city,
|
| 1669 |
+
"region" => $region,
|
| 1670 |
+
"postcode" => $postcode,
|
| 1671 |
+
"country_id" => $country_id,
|
| 1672 |
+
"telephone" => "$telephone",
|
| 1673 |
+
"is_default_shipping" => 0,
|
| 1674 |
+
"is_default_billing" => 0
|
| 1675 |
+
)
|
| 1676 |
+
);
|
| 1677 |
+
|
| 1678 |
+
try{
|
| 1679 |
+
$resultCustomerAddresses = $soap->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses));
|
| 1680 |
+
}
|
| 1681 |
+
catch(Exception $e){
|
| 1682 |
+
$error .= $e->getMessage()."<br>";
|
| 1683 |
+
}
|
| 1684 |
+
|
| 1685 |
+
if($error == "") ### checking when there is no error set customer address for shopping cart
|
| 1686 |
+
{
|
| 1687 |
+
$shippingMethod = "bluefish_connection_bluefish_connection";
|
| 1688 |
+
|
| 1689 |
+
try{
|
| 1690 |
+
$resultShippingMethod = $soap->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod));
|
| 1691 |
+
}
|
| 1692 |
+
catch(Exception $e){
|
| 1693 |
+
$error .= $e->getMessage()."<br>";
|
| 1694 |
+
}
|
| 1695 |
+
|
| 1696 |
+
if($error == "") ### checking when there is no error set shipping method for sale
|
| 1697 |
+
{
|
| 1698 |
+
#$paymentMethod = ($paymentMethod == "CASH")?"checkmo":"ccsave";
|
| 1699 |
+
$paymentMethod = "bluefish_connection";
|
| 1700 |
+
|
| 1701 |
+
#### set payment method
|
| 1702 |
+
$paymentMethod = array(
|
| 1703 |
+
"method" => $paymentMethod
|
| 1704 |
+
);
|
| 1705 |
+
|
| 1706 |
+
try{
|
| 1707 |
+
$resultPaymentMethod = $soap->call($sessionId, "cart_payment.method", array($shoppingCartId, $paymentMethod));
|
| 1708 |
+
}
|
| 1709 |
+
catch(Exception $e){
|
| 1710 |
+
$error .= $e->getMessage()."<br>";
|
| 1711 |
+
}
|
| 1712 |
+
if($error == "") ### checking when there is no error set payment method for sale
|
| 1713 |
+
{
|
| 1714 |
+
try{
|
| 1715 |
+
$shoppingCartInfo = $soap->call($sessionId, "cart.info", array($shoppingCartId));
|
| 1716 |
+
|
| 1717 |
+
$item_array = $shoppingCartInfo[items];
|
| 1718 |
+
|
| 1719 |
+
$item_id = array();
|
| 1720 |
+
|
| 1721 |
+
foreach($item_array as $item_key=>$item_val){
|
| 1722 |
+
$item_id[] = $item_val[item_id];
|
| 1723 |
+
}
|
| 1724 |
+
|
| 1725 |
+
for($k=0;$k<count($xmlData->sale[$i]->items->item);$k++){
|
| 1726 |
+
|
| 1727 |
+
$finalAmount = "";
|
| 1728 |
+
$finalAmountExclTax = "";
|
| 1729 |
+
$quantity = "";
|
| 1730 |
+
$quantity = (int)$xmlData->sale[$i]->items->item[$k]->quantity;
|
| 1731 |
+
$finalAmountExclTax = (float)$xmlData->sale[$i]->items->item[$k]->finalAmountExclTax;
|
| 1732 |
+
|
| 1733 |
+
|
| 1734 |
+
$finalAmount = (float)($finalAmountExclTax / $quantity);
|
| 1735 |
+
|
| 1736 |
+
if ($quantity < 1) {
|
| 1737 |
+
$finalAmount = -$finalAmount;
|
| 1738 |
+
}
|
| 1739 |
+
|
| 1740 |
+
|
| 1741 |
+
$connection->query("UPDATE ".$prefix."sales_flat_quote_item SET
|
| 1742 |
+
`custom_price` = '$finalAmount',
|
| 1743 |
+
`original_custom_price` = '$finalAmount',
|
| 1744 |
+
`qty` = '$quantity'
|
| 1745 |
+
WHERE `sales_flat_quote_item`.`item_id` =".$item_id[$k]);
|
| 1746 |
+
}
|
| 1747 |
+
|
| 1748 |
+
}
|
| 1749 |
+
catch(Exception $e){
|
| 1750 |
+
$error .= $e->getMessage()."<br>";
|
| 1751 |
+
}
|
| 1752 |
+
|
| 1753 |
+
if($error == "") ### checking when there is in cart info API
|
| 1754 |
+
{
|
| 1755 |
+
$licenseForOrderCreation = null;
|
| 1756 |
+
|
| 1757 |
+
try{
|
| 1758 |
+
$orderIncrementId = $soap->call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation));
|
| 1759 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
|
| 1760 |
+
|
| 1761 |
+
//create invoice for the order
|
| 1762 |
+
$invoice = $order->prepareInvoice()
|
| 1763 |
+
->setTransactionId($order->getId())
|
| 1764 |
+
->addComment("Invoice created from Bluestore extension for transaction number - ".$transactionCode)
|
| 1765 |
+
->register()
|
| 1766 |
+
->pay();
|
| 1767 |
+
|
| 1768 |
+
$transaction_save = Mage::getModel('core/resource_transaction')
|
| 1769 |
+
->addObject($invoice)
|
| 1770 |
+
->addObject($invoice->getOrder());
|
| 1771 |
+
|
| 1772 |
+
$transaction_save->save();
|
| 1773 |
+
|
| 1774 |
+
//now create shipment
|
| 1775 |
+
//after creation of shipment, the order auto gets status COMPLETE
|
| 1776 |
+
$shipment = $order->prepareShipment();
|
| 1777 |
+
if( $shipment ) {
|
| 1778 |
+
$shipment->register();
|
| 1779 |
+
$order->setIsInProcess(true);
|
| 1780 |
+
|
| 1781 |
+
$transaction_save = Mage::getModel('core/resource_transaction')
|
| 1782 |
+
->addObject($shipment)
|
| 1783 |
+
->addObject($shipment->getOrder())
|
| 1784 |
+
->save();
|
| 1785 |
+
}
|
| 1786 |
+
|
| 1787 |
+
###### For credit memo only
|
| 1788 |
+
if($orderIncrementId != "" && count($arrQtyRefund) > 0)
|
| 1789 |
+
{
|
| 1790 |
+
foreach($arrQtyRefund as $keyProductID => $valProductQTY)
|
| 1791 |
+
{
|
| 1792 |
+
$newQty = "";
|
| 1793 |
+
$productId = "";
|
| 1794 |
+
$availableStockQty = "";
|
| 1795 |
+
|
| 1796 |
+
$_product = Mage::getModel('catalog/product')->load($keyProductID);
|
| 1797 |
+
|
| 1798 |
+
$stockAvail = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
|
| 1799 |
+
$availableStockQty = $stockAvail->getQty();
|
| 1800 |
+
|
| 1801 |
+
$newQty = $valProductQTY * (-2);
|
| 1802 |
+
$newQty = $newQty + $availableStockQty;
|
| 1803 |
+
$productId = $keyProductID;
|
| 1804 |
+
|
| 1805 |
+
$sql = "UPDATE ".$prefix."cataloginventory_stock_item csi,
|
| 1806 |
+
" .$prefix."cataloginventory_stock_status css
|
| 1807 |
+
SET
|
| 1808 |
+
csi.qty = ?,
|
| 1809 |
+
csi.is_in_stock = ?,
|
| 1810 |
+
css.qty = ?,
|
| 1811 |
+
css.stock_status = ?
|
| 1812 |
+
WHERE
|
| 1813 |
+
csi.product_id = ?
|
| 1814 |
+
AND csi.product_id = css.product_id";
|
| 1815 |
+
$isInStock = $newQty > 0 ? 1 : 0;
|
| 1816 |
+
$stockStatus = $newQty > 0 ? 1 : 0;
|
| 1817 |
+
$connection->query($sql, array($newQty, $isInStock, $newQty, $stockStatus, $productId));
|
| 1818 |
+
}
|
| 1819 |
+
}
|
| 1820 |
+
}
|
| 1821 |
+
catch(Exception $e){
|
| 1822 |
+
$error .= $e->getMessage()."<br>";
|
| 1823 |
+
}
|
| 1824 |
+
}
|
| 1825 |
+
}
|
| 1826 |
+
}
|
| 1827 |
+
}
|
| 1828 |
+
}
|
| 1829 |
+
}
|
| 1830 |
+
}
|
| 1831 |
+
}
|
| 1832 |
+
if($error != "" && $numberFailureorder == 0)
|
| 1833 |
+
{
|
| 1834 |
+
$connection->query("INSERT INTO ".$prefix."bluefish_import_error_logs(id,sale_code,error)
|
| 1835 |
+
VALUES('','".$transactionCode."','".addslashes($error)."')");
|
| 1836 |
+
$errorNum++;
|
| 1837 |
+
}
|
| 1838 |
+
else if($error != "" && $numberFailureorder > 0)
|
| 1839 |
+
{
|
| 1840 |
+
$connection->query("UPDATE ".$prefix."bluefish_import_error_logs SET error = '".addslashes($error)."', error_date = now() WHERE sale_code ='".$transactionCode."'");
|
| 1841 |
+
$errorNum++;
|
| 1842 |
+
}
|
| 1843 |
+
else if($error == "" && $numberFailureorder > 0){
|
| 1844 |
+
$connection->query("DELETE FROM ".$prefix."bluefish_import_error_logs WHERE sale_code ='".$transactionCode."'");
|
| 1845 |
+
}
|
| 1846 |
+
}
|
| 1847 |
+
}
|
| 1848 |
+
|
| 1849 |
+
if((count($xmlData) > 0) && ($transactionNumber == ""))
|
| 1850 |
+
{
|
| 1851 |
+
$updateLastDateVal = max($updateLastDateArr);
|
| 1852 |
+
Mage::getModel('core/config')->saveConfig('mycustom_section/mycustom_sales_import_group/mycustom_bluestore_enddatetime', $updateLastDateVal);
|
| 1853 |
+
}
|
| 1854 |
+
|
| 1855 |
+
if($errorNum > 0){
|
| 1856 |
$flag = "fail";
|
| 1857 |
}elseif(count($xmlData) == 0){
|
| 1858 |
$flag = "blankdata";
|
| 1862 |
return $flag;
|
| 1863 |
}
|
| 1864 |
|
| 1865 |
+
|
| 1866 |
##### Function for generate the completed sales data xml for bluestore
|
| 1867 |
function ExportOrderData()
|
| 1868 |
{
|
| 1897 |
$SaleIterationCounter = $resultSaleIteration[0][loopCounter];
|
| 1898 |
$SaleCounterDB = $resultSaleIteration[0][loopIteration];
|
| 1899 |
|
| 1900 |
+
$credentials = Mage::getStoreConfig('mycustom_section/mycustom_sales_group');
|
| 1901 |
$commonschedule_Sale = $credentials['mycustom_sales_commonschedule'];
|
| 1902 |
$unserielSaleVal = unserialize($commonschedule_Sale);
|
| 1903 |
+
$lastUpdatedDate = $credentials['mycustom_sales_last_export'];
|
| 1904 |
|
| 1905 |
$SaleCount = 0;
|
| 1906 |
|
| 1932 |
|
| 1933 |
$markers=$doc->getElementsByTagName('bluefish_connection_orderexport');
|
| 1934 |
$markersimport =$doc->getElementsByTagName('bluefish_connection_orderimport');
|
| 1935 |
+
|
| 1936 |
foreach ($markers as $marker)
|
| 1937 |
{
|
| 1938 |
$type=$marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $Sale_cron_schedule_time;
|
| 1948 |
|
| 1949 |
try
|
| 1950 |
{
|
| 1951 |
+
#$thesearch =array(array('updated_at'=>array('from'=>"$thedate"),'increment_id'=>array('200002634'), 'status'=>array('eq'=>"complete")));
|
| 1952 |
+
|
| 1953 |
+
if($lastUpdatedDate !="")
|
| 1954 |
+
{
|
| 1955 |
+
$thesearch =array(array('updated_at'=>array('gt'=>$lastUpdatedDate), 'status'=>array('eq'=>"complete")));
|
| 1956 |
+
$resultOrderList = $soap->call($sessionId, 'order.list',$thesearch);
|
| 1957 |
+
}
|
| 1958 |
+
else
|
| 1959 |
+
{
|
| 1960 |
+
$thesearch =array(array('status'=>array('eq'=>"complete")));
|
| 1961 |
+
$resultOrderList = $soap->call($sessionId, 'order.list',$thesearch);
|
| 1962 |
+
}
|
| 1963 |
}
|
| 1964 |
catch(Exception $e)
|
| 1965 |
{
|
| 1973 |
print_r($resultOrderList);
|
| 1974 |
exit;*/
|
| 1975 |
|
| 1976 |
+
$updatedTimeArray = array();
|
| 1977 |
for($i=0;$i<count($resultOrderList);$i++)
|
| 1978 |
{
|
| 1979 |
$catchError = "";
|
| 1980 |
$catchProductError = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1981 |
|
| 1982 |
+
$result = $connection->query("SELECT id FROM ".$prefix."bluefish_sale_post WHERE order_id = '".$resultOrderList[$i][increment_id]."'");
|
|
|
|
| 1983 |
|
| 1984 |
+
$resultSet = $result->fetchAll(PDO::FETCH_ASSOC);
|
| 1985 |
+
$numberRows = count($resultSet);
|
| 1986 |
|
| 1987 |
+
$resultCustomer = $connection->query("SELECT id,customer_code FROM ".$prefix."bluefish_customer WHERE customer_id = '".$resultOrderList[$i][customer_id]."'");
|
| 1988 |
|
| 1989 |
+
$resultSetCustomer = $resultCustomer->fetchAll(PDO::FETCH_ASSOC);
|
| 1990 |
+
|
| 1991 |
+
if($resultSetCustomer[0][customer_code] != "")
|
| 1992 |
+
{
|
| 1993 |
+
$resultcustomer_id = $resultOrderList[$i][customer_id];
|
| 1994 |
+
$customerCodeafterCheck = $resultSetCustomer[0][customer_code];
|
| 1995 |
+
}
|
| 1996 |
+
else
|
| 1997 |
+
{
|
| 1998 |
+
$resultcustomer_id = $credentials['mycustom_customer_number'];
|
| 1999 |
+
$customerCodeafterCheck = $credentials['mycustom_customer_number'];
|
| 2000 |
+
}
|
| 2001 |
+
|
| 2002 |
+
if(($numberRows == 0) && (($customerCodeafterCheck != "") || ($resultOrderList[$i][customer_is_guest] == '1')))
|
| 2003 |
+
{
|
| 2004 |
+
### For sale order info
|
| 2005 |
+
try
|
| 2006 |
+
{
|
| 2007 |
+
$resultSalesOrder = $soap->call($sessionId, 'sales_order.info', $resultOrderList[$i][increment_id]);
|
| 2008 |
+
}
|
| 2009 |
+
catch(Exception $e)
|
| 2010 |
{
|
| 2011 |
+
$flag = $e->getMessage();
|
| 2012 |
+
Mage::log('Problem in sales_order.info '.$flag.' Exported.', null, './Bluestore_salesorder.log.text');
|
| 2013 |
+
$catchError = "fail";
|
| 2014 |
+
}
|
| 2015 |
|
| 2016 |
+
if($catchError != "fail")
|
| 2017 |
{
|
| 2018 |
+
for($q=0;$q<count($resultSalesOrder[items]);$q++)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2019 |
{
|
| 2020 |
+
try
|
| 2021 |
+
{
|
| 2022 |
+
$resultProductExist = $soap->call($sessionId, 'catalog_product.info', $resultSalesOrder[items][$q][product_id]);
|
| 2023 |
+
}
|
| 2024 |
+
catch(Exception $e)
|
| 2025 |
+
{
|
| 2026 |
+
$flag = $e->getMessage();
|
| 2027 |
+
Mage::log('Product for sale item '.$resultSalesOrder[items][$q][product_id].' does not exist. Order# is '.$resultOrderList[$i][increment_id], null, './Bluestore_salesorder.log.text');
|
| 2028 |
+
$catchProductError = "ProductNotExist";
|
| 2029 |
+
}
|
| 2030 |
+
}
|
| 2031 |
+
}
|
| 2032 |
+
if($catchProductError == "")
|
| 2033 |
+
{
|
| 2034 |
+
$updatedTimeArray[] = $resultOrderList[$i][updated_at];
|
| 2035 |
|
| 2036 |
+
if($zz == 0)
|
| 2037 |
{
|
| 2038 |
+
$xmlRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
| 2039 |
+
<inbound lang=\"en\" enterprise=\"".$enterprise_code."\" requestNo=\"1\">
|
| 2040 |
+
";
|
| 2041 |
+
}
|
| 2042 |
+
$customerFullName = $resultOrderList[$i][customer_firstname];
|
| 2043 |
+
|
| 2044 |
+
if($resultOrderList[$i][customer_lastname] != "")
|
| 2045 |
+
$customerFullName = $resultOrderList[$i][customer_firstname]." ".$resultOrderList[$i][customer_lastname];
|
| 2046 |
+
$docNO = $zz+1;
|
| 2047 |
+
|
| 2048 |
+
$AmountsIncludeTax = ($resultOrderList[$i][tax_amount] > 0)?'true':'false';
|
| 2049 |
+
$saleAmountIncludeTax = $resultOrderList[$i][total_paid];
|
| 2050 |
+
|
| 2051 |
+
$xmlRequest .= "<batch batchNo=\"".$docNO."\">
|
| 2052 |
+
<transactionSales>
|
| 2053 |
+
<transactionSale docNo=\"".$resultOrderList[$i][increment_id]."\">
|
| 2054 |
+
<postStockMovements>true</postStockMovements>
|
| 2055 |
+
<saleHeader>
|
| 2056 |
+
<terminalTransactionNo>".$resultOrderList[$i][increment_id]."</terminalTransactionNo>
|
| 2057 |
+
<storeCode>".$mycustom_bluestorecode."</storeCode>
|
| 2058 |
+
<terminalCode>1</terminalCode>
|
| 2059 |
+
<startDateTime>".$resultOrderList[$i][created_at]."</startDateTime>
|
| 2060 |
+
<endDateTime>".$resultOrderList[$i][updated_at]."</endDateTime>
|
| 2061 |
+
<sessionID>".$sessionId."</sessionID>
|
| 2062 |
+
<userCode>".$resultcustomer_id."</userCode>
|
| 2063 |
+
<orderCurrencyCode>".$resultOrderList[$i][base_currency_code]."</orderCurrencyCode>
|
| 2064 |
+
<saleAmount>".$saleAmountIncludeTax."</saleAmount>
|
| 2065 |
+
<totalTax>".$resultOrderList[$i][tax_amount]."</totalTax>
|
| 2066 |
+
<amountsIncludeTax>".$AmountsIncludeTax."</amountsIncludeTax>
|
| 2067 |
+
</saleHeader>
|
| 2068 |
+
";
|
| 2069 |
+
|
| 2070 |
+
|
| 2071 |
+
### For sale order info
|
| 2072 |
+
try
|
| 2073 |
+
{
|
| 2074 |
+
$resultSalesOrder = $soap->call($sessionId, 'sales_order.info', $resultOrderList[$i][increment_id]);
|
| 2075 |
+
}
|
| 2076 |
+
catch(Exception $e)
|
| 2077 |
+
{
|
| 2078 |
+
$flag = $e->getMessage();
|
| 2079 |
+
Mage::log('Problem in sales_order.info '.$flag.' Exported.', null, './Bluestore_salesorder.log.text');
|
| 2080 |
+
}
|
| 2081 |
+
|
| 2082 |
+
$SalefirstName = str_ireplace("&", "&", $resultSalesOrder[customer_firstname]);
|
| 2083 |
+
$SalelastName = str_ireplace("&", "&", $resultSalesOrder[customer_lastname]);
|
| 2084 |
+
$street1Addr = str_ireplace("&", "&", $resultSalesOrder[shipping_address][street]);
|
| 2085 |
+
|
| 2086 |
+
$xmlRequest .= "<customer>
|
| 2087 |
+
<countryCode>".$resultSalesOrder[shipping_address][country_id]."</countryCode>
|
| 2088 |
+
<customerCode>".$customerCodeafterCheck."</customerCode>
|
| 2089 |
+
<email>".$resultSalesOrder[customer_email]."</email>
|
| 2090 |
+
<firstName>".$SalefirstName."</firstName>
|
| 2091 |
+
<lastName>".$SalelastName."</lastName>
|
| 2092 |
+
<postalZipCode>".$resultSalesOrder[shipping_address][postcode]."</postalZipCode>
|
| 2093 |
+
<street1>".$street1Addr."</street1>
|
| 2094 |
+
<telephone1>".$resultSalesOrder[shipping_address][telephone]."</telephone1>
|
| 2095 |
+
<title>".$resultSalesOrder[customer_prefix]."</title>
|
| 2096 |
+
<townCity>".$resultSalesOrder[shipping_address][city]."</townCity>
|
| 2097 |
+
</customer>
|
| 2098 |
+
<saleItems>";
|
| 2099 |
+
|
| 2100 |
+
$ITEM_NUMBER = 0;
|
| 2101 |
+
$saleItemChargeAmt = $resultSalesOrder[base_shipping_amount]/count($resultSalesOrder[items]);
|
| 2102 |
+
|
| 2103 |
+
for($j=0;$j<count($resultSalesOrder[items]);$j++)
|
| 2104 |
{
|
| 2105 |
try
|
| 2106 |
{
|
| 2107 |
+
$resultProduct = $soap->call($sessionId, 'catalog_product.info', $resultSalesOrder[items][$j][product_id]);
|
| 2108 |
}
|
| 2109 |
catch(Exception $e)
|
| 2110 |
{
|
| 2111 |
$flag = $e->getMessage();
|
| 2112 |
+
Mage::log('Product for sale item '.$resultSalesOrder[items][$j][product_id].' does not exist. Order# is '.$resultOrderList[$i][increment_id], null, './Bluestore_salesorder.log.text');
|
| 2113 |
+
$catchError = "fail";
|
| 2114 |
+
}
|
| 2115 |
+
|
| 2116 |
+
try
|
| 2117 |
+
{
|
| 2118 |
+
$config_saledefaultcategory = $credentials['mycustom_saledefaultcategory'];
|
| 2119 |
+
$saledefaultcategory = ($resultProduct[categories][0] == "")?$config_saledefaultcategory:$resultProduct[categories][0];
|
| 2120 |
+
$resultCategory = $soap->call($sessionId, 'catalog_category.info', $saledefaultcategory);
|
| 2121 |
}
|
| 2122 |
+
catch(Exception $e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2123 |
{
|
| 2124 |
$flag = $e->getMessage();
|
| 2125 |
+
Mage::log('Problem in catalog_category.info '.$flag.' => '.$resultProduct[categories][0].' Exported.', null, './Bluestore_salesorder.log.text');
|
| 2126 |
+
$catchError = "fail";
|
| 2127 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2128 |
|
| 2129 |
+
$resultCategoryCode = $connection->query("SELECT code FROM ".$prefix."bluefish_category WHERE category_id = '".$resultCategory[category_id]."'");
|
| 2130 |
+
$resultSetCatCode = $resultCategoryCode->fetchAll(PDO::FETCH_ASSOC);
|
| 2131 |
+
$updateCategoryCode = ($resultSetCatCode[0][code] == "")?$resultCategory[category_id]:$resultSetCatCode[0][code];
|
| 2132 |
|
| 2133 |
+
$credentialsTax = Mage::getStoreConfig('mycustom_section/mycustom_taxcode_group');
|
| 2134 |
+
$TaxCodeSerialArr = $credentialsTax['mycustom_taxcode_rates'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2135 |
|
| 2136 |
+
$unserielTaxVal = unserialize($TaxCodeSerialArr);
|
| 2137 |
|
| 2138 |
+
$TAXCODE_VAL = "";
|
| 2139 |
+
foreach($unserielTaxVal as $oldrate => $oldtaxcode)
|
| 2140 |
{
|
| 2141 |
+
if($resultSalesOrder[items][$j][tax_amount] == $oldtaxcode['rate'])
|
| 2142 |
{
|
| 2143 |
+
$TAXCODE_VAL = $oldtaxcode['taxcode'];
|
| 2144 |
}
|
| 2145 |
}
|
| 2146 |
|
| 2147 |
+
if($TAXCODE_VAL == "")
|
| 2148 |
+
$TAXCODE_VAL = "UK1";
|
| 2149 |
+
|
| 2150 |
+
$ITEM_NUMBER = $j+1;
|
| 2151 |
+
$TotalfinalAmount = $resultSalesOrder[items][$j][base_row_total_incl_tax] + $saleItemChargeAmt;
|
| 2152 |
+
$fixedAmountCharges = $resultSalesOrder[base_shipping_amount];
|
| 2153 |
+
|
| 2154 |
+
$productDescription = str_ireplace("&", "&", $resultProduct[name]);
|
| 2155 |
+
$categoryDescription = str_ireplace("&", "&", $resultCategory[name]);
|
| 2156 |
+
|
| 2157 |
+
$taxRate = ($resultSalesOrder[items][$j][tax_percent] == "")?'0.0000':$resultSalesOrder[items][$j][tax_percent];
|
| 2158 |
+
$taxAmount = ($resultSalesOrder[items][$j][tax_amount] == "")?'0.0000':$resultSalesOrder[items][$j][tax_amount];
|
| 2159 |
+
|
| 2160 |
+
$config_chargescode = $credentials['mycustom_sale_chargescode'];
|
| 2161 |
+
$xmlRequest .= "<saleItem>
|
| 2162 |
+
<itemNumber>".$ITEM_NUMBER."</itemNumber>
|
| 2163 |
+
<productCode>".$resultProduct[sku]."</productCode>
|
| 2164 |
+
<productDescription>".$productDescription."</productDescription>
|
| 2165 |
+
<categoryCode>".$updateCategoryCode."</categoryCode>
|
| 2166 |
+
<categoryDescription>".$categoryDescription."</categoryDescription>
|
| 2167 |
+
<price>".$resultSalesOrder[items][$j][price]."</price>
|
| 2168 |
<currencyCode>".$resultSalesOrder[order_currency_code]."</currencyCode>
|
| 2169 |
+
<quantity>".number_format($resultSalesOrder[items][$j][qty_invoiced])."</quantity>
|
| 2170 |
+
<unitOfMeasure>EA</unitOfMeasure>
|
| 2171 |
+
<finalAmount>".$TotalfinalAmount."</finalAmount>
|
| 2172 |
+
<saleItemTaxes>
|
| 2173 |
+
<saleItemTax>
|
| 2174 |
+
<saleItemTaxNo>1</saleItemTaxNo>
|
| 2175 |
+
<taxCode>".$TAXCODE_VAL."</taxCode>
|
| 2176 |
+
<baseAmount>".$resultSalesOrder[base_tax_amount]."</baseAmount>
|
| 2177 |
+
<currencyCode>".$resultSalesOrder[order_currency_code]."</currencyCode>
|
| 2178 |
+
<taxRate>".$taxRate."</taxRate>
|
| 2179 |
+
<taxAmount>".$taxAmount."</taxAmount>
|
| 2180 |
+
</saleItemTax>
|
| 2181 |
+
</saleItemTaxes>
|
| 2182 |
+
<saleItemCharges>
|
| 2183 |
+
<saleItemCharge>
|
| 2184 |
+
<saleItemChargeNo>".$ITEM_NUMBER."</saleItemChargeNo>
|
| 2185 |
+
<chargeCode>".$config_chargescode."</chargeCode>
|
| 2186 |
+
<chargeDescription>".$resultSalesOrder[shipping_description]."</chargeDescription>
|
| 2187 |
+
<level>1</level>
|
| 2188 |
+
<type>2</type>
|
| 2189 |
+
<fixedAmountCurrency>".$resultSalesOrder[order_currency_code]."</fixedAmountCurrency>
|
| 2190 |
+
<fixedAmount>".$fixedAmountCharges."</fixedAmount>
|
| 2191 |
+
<baseAmount>".$resultSalesOrder[items][$j][base_row_total]."</baseAmount>
|
| 2192 |
+
<baseAmountCurrency>".$resultSalesOrder[order_currency_code]."</baseAmountCurrency>
|
| 2193 |
+
<amount>".$saleItemChargeAmt."</amount>
|
| 2194 |
+
</saleItemCharge>
|
| 2195 |
+
</saleItemCharges>
|
| 2196 |
+
</saleItem>";
|
| 2197 |
+
}
|
| 2198 |
+
|
| 2199 |
+
$credentialsPayCode = Mage::getStoreConfig('mycustom_section/mycustom_payment_group');
|
| 2200 |
+
$PayCodeSerialArr = $credentialsPayCode['mycustom_payment_checkmethod'];
|
| 2201 |
+
|
| 2202 |
+
$unserielPayCodeVal = unserialize($PayCodeSerialArr);
|
| 2203 |
+
|
| 2204 |
+
$PAYMENTCODE_VAL = "";
|
| 2205 |
+
foreach($unserielPayCodeVal as $oldmethod => $oldpaymentcode)
|
| 2206 |
+
{
|
| 2207 |
+
if($resultSalesOrder[payment][method] == $oldpaymentcode['paymentmethod'])
|
| 2208 |
+
{
|
| 2209 |
+
$PAYMENTCODE_VAL = $oldpaymentcode['bluestorecode'];
|
| 2210 |
+
}
|
| 2211 |
+
}
|
| 2212 |
|
| 2213 |
+
if($PAYMENTCODE_VAL == "")
|
| 2214 |
+
$PAYMENTCODE_VAL = "1";
|
| 2215 |
+
|
| 2216 |
+
$xmlRequest .= "</saleItems>
|
| 2217 |
+
<payments>
|
| 2218 |
+
<payment>
|
| 2219 |
+
<paymentNo>".$resultSalesOrder[increment_id]."</paymentNo>
|
| 2220 |
+
<tenderType>2</tenderType>
|
| 2221 |
+
<paymentMethodCode>".$PAYMENTCODE_VAL."</paymentMethodCode>
|
| 2222 |
+
<amount>".$resultSalesOrder[payment][amount_ordered]."</amount>
|
| 2223 |
+
<currencyCode>".$resultSalesOrder[order_currency_code]."</currencyCode>
|
| 2224 |
+
</payment>
|
| 2225 |
+
</payments>
|
| 2226 |
+
</transactionSale>
|
| 2227 |
+
</transactionSales>
|
| 2228 |
+
</batch>";
|
| 2229 |
+
$zz++;
|
| 2230 |
}
|
| 2231 |
+
|
| 2232 |
+
}
|
| 2233 |
+
|
| 2234 |
if($i == count($resultOrderList)-1 && $xmlRequest !="")
|
| 2235 |
{
|
| 2236 |
$xmlRequest .= "</inbound>";
|
| 2247 |
$flag = $e->getMessage();
|
| 2248 |
$responeXml = "fail";
|
| 2249 |
}
|
| 2250 |
+
|
| 2251 |
+
if($xmlRequest != "" && $xmlRequest != "Exist")
|
| 2252 |
+
{
|
| 2253 |
+
$lastUpdatedDateVal = max($updatedTimeArray);
|
| 2254 |
+
Mage::getModel('core/config')->saveConfig('mycustom_section/mycustom_sales_group/mycustom_sales_last_export', $lastUpdatedDateVal);
|
| 2255 |
+
}
|
| 2256 |
|
| 2257 |
return $responeXml;
|
| 2258 |
}
|
| 2268 |
$enterprise_code = '';
|
| 2269 |
|
| 2270 |
$soap = new SoapClient($mage_url);
|
| 2271 |
+
$sessionId = $soap->login($mage_user, $mage_api_key);
|
| 2272 |
|
| 2273 |
Mage::log('Customer data Export started ......', null, './Bluestore_customer_post.log.text');
|
| 2274 |
|
| 2275 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 2276 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 2277 |
+
|
| 2278 |
try
|
| 2279 |
{
|
| 2280 |
$doc = new DOMDocument();
|
| 2281 |
$varpath = dirname(dirname(dirname(__FILE__)));
|
| 2282 |
$xmlFile = "$varpath/etc/config.xml";
|
| 2283 |
$doc->load($xmlFile);
|
|
|
|
|
|
|
| 2284 |
|
| 2285 |
$resultCustomer = $connection->query("select id,loopCounter,loopIteration from ".$prefix."bluefish_cron_schedule WHERE cronPath = 'mycustom_section/mycustom_customer_group/mycustom_customer_commonschedule'");
|
| 2286 |
$resultCustomerIteration = $resultCustomer->fetchAll(PDO::FETCH_ASSOC);
|
| 2290 |
$credentials = Mage::getStoreConfig('mycustom_section/mycustom_customer_group');
|
| 2291 |
$commonschedule_Customer = $credentials['mycustom_customer_commonschedule'];
|
| 2292 |
$unserielCustomerVal = unserialize($commonschedule_Customer);
|
| 2293 |
+
$lastUpdatedDate = $credentials['mycustom_customer_last_export'];
|
| 2294 |
|
| 2295 |
$CustomerCount = 0;
|
| 2296 |
|
| 2303 |
}
|
| 2304 |
if($CustomerIterationCounter == $CustomerCounterDB)
|
| 2305 |
{
|
| 2306 |
+
$counterDB = 1;
|
| 2307 |
$Hourcronconfig = $FirstValHour;
|
| 2308 |
$Minutecronconfig = $FirstValMinute;
|
| 2309 |
}
|
| 2333 |
$doc->saveXML();
|
| 2334 |
$doc->save($xmlFile);
|
| 2335 |
|
| 2336 |
+
#$thesearch =array(array('customer_id'=>array('from'=>'1','to'=>"2")));
|
| 2337 |
+
|
| 2338 |
+
$thesearch =array(array('updated_at'=>array('gt'=>$lastUpdatedDate)));
|
| 2339 |
+
|
| 2340 |
+
if($lastUpdatedDate !="")
|
| 2341 |
+
$customerList = $soap->call($sessionId, 'customer.list',$thesearch);
|
| 2342 |
+
else
|
| 2343 |
+
$customerList = $soap->call($sessionId, 'customer.list');
|
| 2344 |
+
|
| 2345 |
+
|
| 2346 |
#echo "<pre>";
|
| 2347 |
#print_r($customerList);
|
| 2348 |
#exit;
|
| 2349 |
+
|
| 2350 |
+
$zz = 0;
|
| 2351 |
+
$arrayXml = array();
|
| 2352 |
+
$updatedTimeArray = array();
|
| 2353 |
+
|
| 2354 |
for($i=0;$i<count($customerList);$i++)
|
| 2355 |
{
|
| 2356 |
$result = $connection->query("SELECT id,customer_code FROM ".$prefix."bluefish_customer WHERE customer_id = '".$customerList[$i][customer_id]."'");
|
| 2358 |
$resultSet = $result->fetchAll(PDO::FETCH_ASSOC);
|
| 2359 |
$numberRows = count($resultSet);
|
| 2360 |
|
| 2361 |
+
### For Customer info
|
| 2362 |
+
$customerAddressInfo = $soap->call($sessionId,'customer_address.list',$customerList[$i][customer_id]);
|
| 2363 |
+
#echo "<pre>";
|
| 2364 |
+
#print_r($customerAddressInfo);exit;
|
| 2365 |
+
|
| 2366 |
+
$docNO = $zz+1;
|
| 2367 |
+
$isDelivery = ($customerAddressInfo[0][is_default_billing] == '1')?'true':'false';
|
| 2368 |
+
$isCorrespondence = ($customerAddressInfo[0][is_default_shipping] == '1')?'true':'false';
|
| 2369 |
+
|
| 2370 |
+
$firstName = "";
|
| 2371 |
+
$lastName = "";
|
| 2372 |
+
$companyName = "";
|
| 2373 |
+
$street1 = "";
|
| 2374 |
+
$city = "";
|
| 2375 |
+
$region = "";
|
| 2376 |
+
$postcode = "";
|
| 2377 |
+
$country = "";
|
| 2378 |
+
$email = "";
|
| 2379 |
+
$telephone = "";
|
| 2380 |
+
$xmlRequest = "";
|
| 2381 |
+
$updatedTimeArray[] = $customerList[$i][updated_at];
|
| 2382 |
+
|
| 2383 |
+
$xmlRequest .= "<batch batchNo=\"".$docNO."\">
|
| 2384 |
+
<customers>
|
| 2385 |
+
<customer docNo=\"".$customerList[$i][customer_id]."\">";
|
| 2386 |
+
if($numberRows > 0 && $resultSet[0][customer_code] > 0)
|
| 2387 |
+
{
|
| 2388 |
+
$xmlRequest .= "<code>".$resultSet[0][customer_code]."</code>";
|
| 2389 |
}
|
| 2390 |
+
|
| 2391 |
+
$xmlRequest .= "<externalRef></externalRef>
|
| 2392 |
+
<taxOrVatRef></taxOrVatRef>
|
| 2393 |
+
<addresses>
|
| 2394 |
+
<address>";
|
| 2395 |
+
|
| 2396 |
+
$firstName = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerList[$i][firstname]);
|
| 2397 |
+
$lastName = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerList[$i][lastname]);
|
| 2398 |
+
$companyName = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerAddressInfo[0][company]);
|
| 2399 |
+
$street1 = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerAddressInfo[0][street]);
|
| 2400 |
+
$city = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerAddressInfo[0][city]);
|
| 2401 |
+
$region = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerAddressInfo[0][region]);
|
| 2402 |
+
$postcode = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerAddressInfo[0][postcode]);
|
| 2403 |
+
$country = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerAddressInfo[0][country_id]);
|
| 2404 |
+
$email = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerList[$i][email]);
|
| 2405 |
+
$telephone = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $customerAddressInfo[0][telephone]);
|
| 2406 |
|
| 2407 |
+
|
| 2408 |
+
$xmlRequest .= "<isCorrespondence>true</isCorrespondence>
|
| 2409 |
+
<isBilling>true</isBilling>
|
| 2410 |
+
<isDelivery>true</isDelivery>
|
| 2411 |
+
<title>".$customerList[$i][prefix]."</title>
|
| 2412 |
+
<firstName>".$firstName."</firstName>
|
| 2413 |
+
<lastName>".$lastName."</lastName>";
|
| 2414 |
+
|
| 2415 |
+
if($companyName != "")
|
| 2416 |
+
{
|
| 2417 |
+
$xmlRequest .= "<companyName>".$companyName."</companyName>";
|
| 2418 |
+
}
|
| 2419 |
+
if($street1 != "")
|
| 2420 |
+
{
|
| 2421 |
+
$xmlRequest .= "<street1>".$street1."</street1>";
|
| 2422 |
+
}
|
| 2423 |
+
if($city != "")
|
| 2424 |
+
{
|
| 2425 |
+
$xmlRequest .= "<city>".$city."</city>";
|
| 2426 |
+
}
|
| 2427 |
+
if($region != "")
|
| 2428 |
+
{
|
| 2429 |
+
$xmlRequest .= "<stateOrRegion>".$region."</stateOrRegion>";
|
| 2430 |
+
}
|
| 2431 |
+
|
| 2432 |
+
if($postcode != "")
|
| 2433 |
+
{
|
| 2434 |
+
$xmlRequest .= "<postalCode>".$postcode."</postalCode>";
|
| 2435 |
+
}
|
| 2436 |
+
if($country != "")
|
| 2437 |
+
{
|
| 2438 |
+
$xmlRequest .= "<country>".$country."</country>";
|
| 2439 |
+
}
|
| 2440 |
+
if($telephone != "")
|
| 2441 |
+
{
|
| 2442 |
+
$xmlRequest .= "<phone1>".$telephone."</phone1>";
|
| 2443 |
+
}
|
| 2444 |
+
if($email != "")
|
| 2445 |
+
{
|
| 2446 |
+
$xmlRequest .= "<email>".$email."</email>";
|
| 2447 |
+
}
|
| 2448 |
+
|
| 2449 |
+
$xmlRequest .= "</address>
|
| 2450 |
+
</addresses>
|
| 2451 |
+
</customer>
|
| 2452 |
+
</customers>
|
| 2453 |
+
</batch>
|
| 2454 |
+
";
|
| 2455 |
+
|
| 2456 |
+
$arrayXml[] = $xmlRequest;
|
| 2457 |
+
|
| 2458 |
+
if($customerList[$i][firstname] != "" && $customerList[$i][lastname] != "" && $customerList[$i][email] !="" && $numberRows == 0)
|
| 2459 |
+
{
|
| 2460 |
+
$InsertCustomer = $connection->query("INSERT INTO ".$prefix."bluefish_customer(id,customer_id,address_id,created_time)
|
| 2461 |
+
VALUES('','".$customerList[$i][customer_id]."','".$customerAddressInfo[0][customer_address_id]."','".now()."')");
|
| 2462 |
+
}
|
| 2463 |
+
$zz++;
|
| 2464 |
+
}
|
| 2465 |
+
Mage::log('Customer data get successfully.', null, './Bluestore_customer_post.log.text');
|
| 2466 |
|
| 2467 |
+
if($xmlRequest == "")
|
| 2468 |
+
$xmlRequest = "Exist";
|
| 2469 |
|
| 2470 |
+
$responeXml = $xmlRequest;
|
| 2471 |
+
}
|
| 2472 |
+
catch(Exception $e)
|
| 2473 |
+
{
|
| 2474 |
+
Mage::log('Customer '.$result.' not created.', null, './Bluestore_customer_post.log.text');
|
| 2475 |
+
$flag = $e->getMessage();
|
| 2476 |
+
$responeXml = "fail";
|
| 2477 |
+
}
|
| 2478 |
+
|
| 2479 |
+
if(count($arrayXml) > 0)
|
| 2480 |
+
{
|
| 2481 |
+
$lastUpdatedDateVal = max($updatedTimeArray);
|
| 2482 |
+
Mage::getModel('core/config')->saveConfig('mycustom_section/mycustom_customer_group/mycustom_customer_last_export', $lastUpdatedDateVal);
|
| 2483 |
+
}
|
| 2484 |
+
return $arrayXml;
|
| 2485 |
+
}
|
| 2486 |
+
|
| 2487 |
+
##### Function for generate the magento product data xml for bluestore
|
| 2488 |
+
function ExportProductData()
|
| 2489 |
+
{
|
| 2490 |
+
ini_set('memory_limit', '256M');
|
| 2491 |
+
$mage_url = Mage::getBaseUrl()."api/soap/?wsdl";
|
| 2492 |
+
$credentials_auth= Mage::getStoreConfig('mycustom_section/mycustom_auth_group');
|
| 2493 |
+
$mage_user = $credentials_auth['mycustom_login'];
|
| 2494 |
+
$mage_api_key = $credentials_auth['mycustom_password'];
|
| 2495 |
+
$enterprise_code = '';
|
| 2496 |
+
|
| 2497 |
+
$soap = new SoapClient($mage_url);
|
| 2498 |
+
$sessionId = $soap->login($mage_user, $mage_api_key);
|
| 2499 |
+
|
| 2500 |
+
Mage::log('Product data Export started ......', null, './Bluestore_productexport.log.text');
|
| 2501 |
+
|
| 2502 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 2503 |
+
$prefix = Mage::getConfig()->getTablePrefix();
|
| 2504 |
+
|
| 2505 |
+
try
|
| 2506 |
+
{
|
| 2507 |
+
$doc = new DOMDocument();
|
| 2508 |
+
$varpath = dirname(dirname(dirname(__FILE__)));
|
| 2509 |
+
$xmlFile = "$varpath/etc/config.xml";
|
| 2510 |
+
$doc->load($xmlFile);
|
| 2511 |
+
|
| 2512 |
+
$resultCustomer = $connection->query("select id,loopCounter,loopIteration from ".$prefix."bluefish_cron_schedule WHERE cronPath = 'mycustom_section/mycustom_product_group/mycustom_product_commonschedule'");
|
| 2513 |
+
$resultCustomerIteration = $resultCustomer->fetchAll(PDO::FETCH_ASSOC);
|
| 2514 |
+
$CustomerIterationCounter = $resultCustomerIteration[0][loopCounter];
|
| 2515 |
+
$CustomerCounterDB = $resultCustomerIteration[0][loopIteration];
|
| 2516 |
+
|
| 2517 |
+
$credentials = Mage::getStoreConfig('mycustom_section/mycustom_product_group');
|
| 2518 |
+
$commonschedule_Customer = $credentials['mycustom_product_commonschedule'];
|
| 2519 |
+
$unserielCustomerVal = unserialize($commonschedule_Customer);
|
| 2520 |
+
|
| 2521 |
+
$credentialsExport = Mage::getStoreConfig('mycustom_section/mycustom_product_export_group');
|
| 2522 |
+
$lastUpdatedDate = $credentialsExport['mycustom_product_last_export'];
|
| 2523 |
+
$unitOfMeasureCode = $credentialsExport['mycustom_unitofmeasure'];
|
| 2524 |
+
|
| 2525 |
+
$productCount = 0;
|
| 2526 |
+
|
| 2527 |
+
foreach($unserielCustomerVal as $keyCustomerCronTime => $valueCustomerCronTime)
|
| 2528 |
+
{
|
| 2529 |
+
if($productCount == 0)
|
| 2530 |
+
{
|
| 2531 |
+
$FirstValHour = $valueCustomerCronTime['Hourcronconfig'];
|
| 2532 |
+
$FirstValMinute = $valueCustomerCronTime['Minutecronconfig'];
|
| 2533 |
+
}
|
| 2534 |
+
if($CustomerIterationCounter == $CustomerCounterDB)
|
| 2535 |
+
{
|
| 2536 |
+
$counterDB = 1;
|
| 2537 |
+
$Hourcronconfig = $FirstValHour;
|
| 2538 |
+
$Minutecronconfig = $FirstValMinute;
|
| 2539 |
+
}
|
| 2540 |
+
if($productCount == $CustomerCounterDB)
|
| 2541 |
+
{
|
| 2542 |
+
$counterDB = $CustomerCounterDB + 1;
|
| 2543 |
+
$Hourcronconfig = $valueCustomerCronTime['Hourcronconfig'];
|
| 2544 |
+
$Minutecronconfig = $valueCustomerCronTime['Minutecronconfig'];
|
| 2545 |
+
}
|
| 2546 |
+
$productCount++;
|
| 2547 |
+
}
|
| 2548 |
+
|
| 2549 |
+
$produtCronScheduleTime = $Minutecronconfig." ".$Hourcronconfig." * * *";
|
| 2550 |
+
|
| 2551 |
+
$connection->query("UPDATE ".$prefix."bluefish_cron_schedule SET loopIteration= '".$counterDB."' where id = '".$resultCustomerIteration[0][id]."'");
|
| 2552 |
+
|
| 2553 |
+
$markersexport=$doc->getElementsByTagName('bluefish_connection_productexport');
|
| 2554 |
+
$markers=$doc->getElementsByTagName('bluefish_connection_product');
|
| 2555 |
+
foreach ($markersexport as $marker)
|
| 2556 |
+
{
|
| 2557 |
+
$type=$marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $produtCronScheduleTime;
|
| 2558 |
+
}
|
| 2559 |
+
foreach ($markers as $marker)
|
| 2560 |
+
{
|
| 2561 |
+
$type=$marker->getElementsByTagName('cron_expr')->item(0)->nodeValue = $produtCronScheduleTime;
|
| 2562 |
+
}
|
| 2563 |
+
$doc->saveXML();
|
| 2564 |
+
$doc->save($xmlFile);
|
| 2565 |
+
|
| 2566 |
+
if($lastUpdatedDate !="")
|
| 2567 |
+
{
|
| 2568 |
+
$productListResult = $connection->query("SELECT `entity_id`,`sku`,`updated_at` FROM ".$prefix."catalog_product_entity WHERE `updated_at` > '".$lastUpdatedDate."'");
|
| 2569 |
+
|
| 2570 |
+
}
|
| 2571 |
+
else
|
| 2572 |
+
{
|
| 2573 |
+
$productListResult = $connection->query("SELECT `sku` FROM ".$prefix."catalog_product_entity");
|
| 2574 |
+
}
|
| 2575 |
+
$productList = $productListResult->fetchAll(PDO::FETCH_ASSOC);
|
| 2576 |
+
|
| 2577 |
+
$numberProductList= count($productList);
|
| 2578 |
+
|
| 2579 |
+
$credentialsSales = Mage::getStoreConfig('mycustom_section/mycustom_sales_import_group');
|
| 2580 |
+
$salesMappingFlag = $credentialsSales['mycustom_sales_mapping_method'];
|
| 2581 |
+
$unserielVal = unserialize($salesMappingFlag);
|
| 2582 |
+
|
| 2583 |
+
$zz = 0;
|
| 2584 |
+
$arrayXml = array();
|
| 2585 |
+
$updatedTimeArray = array();
|
| 2586 |
+
|
| 2587 |
+
for($i=0;$i<count($productList);$i++)
|
| 2588 |
+
{
|
| 2589 |
+
### For Product info
|
| 2590 |
+
$productInfo = $soap->call($sessionId,'catalog_product.info',$productList[$i][entity_id]);
|
| 2591 |
+
|
| 2592 |
+
$docNO = $zz+1;
|
| 2593 |
+
$typeCode = "";
|
| 2594 |
+
|
| 2595 |
+
$credentialsProducts = Mage::getStoreConfig('mycustom_section/mycustom_product_export_group');
|
| 2596 |
+
$productsMappingFlag = $credentialsProducts['mycustom_magento_producttype'];
|
| 2597 |
+
$unserielValProductType = unserialize($productsMappingFlag);
|
| 2598 |
+
|
| 2599 |
+
foreach($unserielValProductType as $keyproducttype => $valproducttype)
|
| 2600 |
+
{
|
| 2601 |
+
if($productInfo[type_id] == $valproducttype['magentoproducttype'])
|
| 2602 |
{
|
| 2603 |
+
$typeCode = $valproducttype['bluestoreproducttype'];
|
| 2604 |
}
|
| 2605 |
+
}
|
| 2606 |
+
|
| 2607 |
+
$xmlRequest = "";
|
| 2608 |
+
$updatedTimeArray[] = $productList[$i][updated_at];
|
| 2609 |
+
$bluestoreCategoryCode = "";
|
| 2610 |
+
$ProductStatus = "";
|
| 2611 |
+
$startDate = "";
|
| 2612 |
+
$productDescription = "";
|
| 2613 |
+
|
| 2614 |
+
$resultCategory = $connection->query("select code from ".$prefix."bluefish_category WHERE category_id = '".$productInfo[categories]['0']."'");
|
| 2615 |
+
$dataCategory = $resultCategory->fetchAll(PDO::FETCH_ASSOC);
|
| 2616 |
+
$numberRowsdataCategory = count($dataCategory);
|
| 2617 |
+
|
| 2618 |
+
if($numberRowsdataCategory > 0)
|
| 2619 |
+
{
|
| 2620 |
+
$bluestoreCategoryCode = $dataCategory[0][code];
|
| 2621 |
+
}
|
| 2622 |
+
$ProductStatus = ($productInfo[status] == "1")?'true':'false';
|
| 2623 |
+
$startDate = date("Y-m-d", strtotime($productInfo[created_at]));
|
| 2624 |
|
| 2625 |
+
$productDescription = str_ireplace(array('&', '"','<', '>'), array('&', '"', '<', '>'), $productInfo[name]);
|
| 2626 |
+
|
| 2627 |
+
$credentialsTaxclass = Mage::getStoreConfig('mycustom_section/mycustom_taxclass_group');
|
| 2628 |
+
$taxClassSerialArr = $credentialsTaxclass['mycustom_taxclass_magento'];
|
| 2629 |
+
$unserielTaxClass = unserialize($taxClassSerialArr);
|
| 2630 |
+
|
| 2631 |
+
$taxClassCode = "";
|
| 2632 |
+
foreach($unserielTaxClass as $key => $valueTax)
|
| 2633 |
+
{
|
| 2634 |
+
if($productInfo[tax_class_id] == $valueTax['magentotaxclass'])
|
| 2635 |
{
|
| 2636 |
+
$taxClassCode = $valueTax['bluestoretaxclass'];
|
| 2637 |
+
}
|
| 2638 |
+
}
|
| 2639 |
+
|
| 2640 |
+
$taxClassCode = ($taxClassCode == "")?"PTX":$taxClassCode;
|
| 2641 |
+
$currencyCode = Mage::app()->getStore('1')->getCurrentCurrencyCode();
|
| 2642 |
+
|
| 2643 |
+
$xmlRequest .= "<batch batchNo=\"".$docNO."\">
|
| 2644 |
+
<products>
|
| 2645 |
+
<product docNo=\"".$productList[$i][entity_id]."\">";
|
| 2646 |
+
|
| 2647 |
+
if($unserielVal['#{_id}']['Salemapping'] == 'Productcode')
|
| 2648 |
+
{
|
| 2649 |
+
$xmlRequest .= "<code>".$productInfo[sku]."</code>";
|
| 2650 |
+
}
|
| 2651 |
+
else{
|
| 2652 |
+
$xmlRequest .= "<code>".$productInfo[product_id]."</code>";
|
| 2653 |
+
}
|
| 2654 |
+
|
| 2655 |
+
|
| 2656 |
+
$xmlRequest .=
|
| 2657 |
+
"<typeCode>".$typeCode."</typeCode>
|
| 2658 |
+
<categoryCode>".$bluestoreCategoryCode."</categoryCode>
|
| 2659 |
+
<taxClassCode>".$taxClassCode."</taxClassCode>
|
| 2660 |
+
<active>".$ProductStatus."</active>
|
| 2661 |
+
<returnable>true</returnable>
|
| 2662 |
+
<saleable>true</saleable>
|
| 2663 |
+
<unitOfMeasureCode>".$unitOfMeasureCode."</unitOfMeasureCode>
|
| 2664 |
+
";
|
| 2665 |
+
if($productInfo[price] != "")
|
| 2666 |
+
{
|
| 2667 |
+
$xmlRequest .= "<price>".$productInfo[price]."</price>";
|
| 2668 |
+
}
|
| 2669 |
+
|
| 2670 |
+
$xmlRequest .=
|
| 2671 |
+
"<currencyCode>".$currencyCode."</currencyCode>
|
| 2672 |
+
<startDate>".$startDate."</startDate>
|
| 2673 |
+
<description>".$productDescription."</description>
|
| 2674 |
+
</product>
|
| 2675 |
+
</products>
|
| 2676 |
+
</batch>";
|
| 2677 |
+
$arrayXml[] = $xmlRequest;
|
| 2678 |
$zz++;
|
| 2679 |
}
|
| 2680 |
+
Mage::log('Product data get successfully.', null, './Bluestore_productexport.log.text');
|
| 2681 |
|
| 2682 |
if($xmlRequest == "")
|
| 2683 |
$xmlRequest = "Exist";
|
| 2686 |
}
|
| 2687 |
catch(Exception $e)
|
| 2688 |
{
|
| 2689 |
+
Mage::log('Product not created.', null, './Bluestore_productexport.log.text');
|
| 2690 |
$flag = $e->getMessage();
|
| 2691 |
$responeXml = "fail";
|
| 2692 |
}
|
| 2693 |
+
|
| 2694 |
+
if(count($arrayXml) > 0)
|
| 2695 |
+
{
|
| 2696 |
+
$lastUpdatedDateVal = max($updatedTimeArray);
|
| 2697 |
+
Mage::getModel('core/config')->saveConfig('mycustom_section/mycustom_product_export_group/mycustom_product_last_export', $lastUpdatedDateVal);
|
| 2698 |
+
}
|
| 2699 |
+
#echo "<pre>";
|
| 2700 |
+
#print_r($arrayXml);die;
|
| 2701 |
+
return $arrayXml;
|
| 2702 |
}
|
| 2703 |
?>
|
app/code/local/Bluefish/Connection/etc/config.xml
CHANGED
|
@@ -2,13 +2,16 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Bluefish_Connection>
|
| 5 |
-
<version>1.1.
|
| 6 |
<depends>
|
| 7 |
<Mage_Shipping/>
|
| 8 |
</depends>
|
| 9 |
<depends>
|
| 10 |
<Mage_Payment/>
|
| 11 |
-
</depends>
|
|
|
|
|
|
|
|
|
|
| 12 |
</Bluefish_Connection>
|
| 13 |
</modules>
|
| 14 |
<frontend>
|
|
@@ -34,8 +37,8 @@
|
|
| 34 |
<connection>
|
| 35 |
<use>admin</use>
|
| 36 |
<args>
|
| 37 |
-
|
| 38 |
-
|
| 39 |
</args>
|
| 40 |
</connection>
|
| 41 |
</routers>
|
|
@@ -105,7 +108,23 @@
|
|
| 105 |
<store>Bluefish_Connection_Model_Store</store>
|
| 106 |
</rewrite>
|
| 107 |
</core>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
<connection>
|
| 110 |
<class>Bluefish_Connection_Model</class>
|
| 111 |
<resourceModel>connection_mysql4</resourceModel>
|
|
@@ -169,32 +188,36 @@
|
|
| 169 |
<crontab>
|
| 170 |
<jobs>
|
| 171 |
<bluefish_connection_category>
|
| 172 |
-
<schedule><cron_expr>
|
| 173 |
-
<run><model>connection/
|
| 174 |
</bluefish_connection_category>
|
| 175 |
<bluefish_connection_product>
|
| 176 |
-
<schedule><cron_expr>
|
| 177 |
-
<run><model>connection/
|
| 178 |
</bluefish_connection_product>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
<bluefish_connection_stock>
|
| 180 |
-
<schedule><cron_expr>
|
| 181 |
-
<run><model>connection/
|
| 182 |
</bluefish_connection_stock>
|
| 183 |
<bluefish_connection_customer>
|
| 184 |
-
<schedule><cron_expr>
|
| 185 |
-
<run><model>connection/
|
| 186 |
</bluefish_connection_customer>
|
| 187 |
<bluefish_connection_customerexport>
|
| 188 |
-
<schedule><cron_expr>
|
| 189 |
-
<run><model>connection/
|
| 190 |
</bluefish_connection_customerexport>
|
| 191 |
<bluefish_connection_orderimport>
|
| 192 |
-
<schedule><cron_expr>
|
| 193 |
-
<run><model>connection/
|
| 194 |
</bluefish_connection_orderimport>
|
| 195 |
<bluefish_connection_orderexport>
|
| 196 |
-
<schedule><cron_expr>
|
| 197 |
-
<run><model>connection/
|
| 198 |
</bluefish_connection_orderexport>
|
| 199 |
</jobs>
|
| 200 |
</crontab>
|
|
@@ -205,7 +228,23 @@
|
|
| 205 |
<mycustom_currentstockversion>0</mycustom_currentstockversion>
|
| 206 |
</mycustom_stock_group>
|
| 207 |
</mycustom_section>
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
<default>
|
| 211 |
<mycustom_section>
|
|
@@ -236,28 +275,28 @@
|
|
| 236 |
</mycustom_section>
|
| 237 |
</default>
|
| 238 |
|
| 239 |
-
|
| 240 |
<mycustom_section>
|
| 241 |
<mycustom_taxcode_group>
|
| 242 |
<mycustom_taxrate_first>0.0000</mycustom_taxrate_first>
|
| 243 |
</mycustom_taxcode_group>
|
| 244 |
</mycustom_section>
|
| 245 |
</default>
|
| 246 |
-
|
| 247 |
<mycustom_section>
|
| 248 |
<mycustom_taxcode_group>
|
| 249 |
<mycustom_taxcode_first>UK0</mycustom_taxcode_first>
|
| 250 |
</mycustom_taxcode_group>
|
| 251 |
</mycustom_section>
|
| 252 |
</default>
|
| 253 |
-
|
| 254 |
<mycustom_section>
|
| 255 |
<mycustom_taxcode_group>
|
| 256 |
<mycustom_taxrate_second>20.0000</mycustom_taxrate_second>
|
| 257 |
</mycustom_taxcode_group>
|
| 258 |
</mycustom_section>
|
| 259 |
</default>
|
| 260 |
-
|
| 261 |
<mycustom_section>
|
| 262 |
<mycustom_taxcode_group>
|
| 263 |
<mycustom_taxcode_second>UK1</mycustom_taxcode_second>
|
|
@@ -265,14 +304,14 @@
|
|
| 265 |
</mycustom_section>
|
| 266 |
</default>
|
| 267 |
|
| 268 |
-
|
| 269 |
<mycustom_section>
|
| 270 |
<mycustom_payment_group>
|
| 271 |
<mycustom_payment_checkmo>5</mycustom_payment_checkmo>
|
| 272 |
</mycustom_payment_group>
|
| 273 |
</mycustom_section>
|
| 274 |
</default>
|
| 275 |
-
|
| 276 |
<mycustom_section>
|
| 277 |
<mycustom_payment_group>
|
| 278 |
<mycustom_payment_cc>11</mycustom_payment_cc>
|
|
@@ -288,20 +327,21 @@
|
|
| 288 |
<title>Carrier Title</title>
|
| 289 |
<name>bluestore_no_shipping</name>
|
| 290 |
<price>0.00</price>
|
|
|
|
| 291 |
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
| 292 |
</bluefish_connection>
|
| 293 |
</carriers>
|
| 294 |
</default>
|
| 295 |
|
| 296 |
-
<default>
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
</default>
|
| 306 |
|
| 307 |
</config>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Bluefish_Connection>
|
| 5 |
+
<version>1.1.4</version>
|
| 6 |
<depends>
|
| 7 |
<Mage_Shipping/>
|
| 8 |
</depends>
|
| 9 |
<depends>
|
| 10 |
<Mage_Payment/>
|
| 11 |
+
</depends>
|
| 12 |
+
<depends>
|
| 13 |
+
<Mage_CatalogInventory/>
|
| 14 |
+
</depends>
|
| 15 |
</Bluefish_Connection>
|
| 16 |
</modules>
|
| 17 |
<frontend>
|
| 37 |
<connection>
|
| 38 |
<use>admin</use>
|
| 39 |
<args>
|
| 40 |
+
<module>Bluefish_Connection</module>
|
| 41 |
+
<frontName>bluefish</frontName>
|
| 42 |
</args>
|
| 43 |
</connection>
|
| 44 |
</routers>
|
| 108 |
<store>Bluefish_Connection_Model_Store</store>
|
| 109 |
</rewrite>
|
| 110 |
</core>
|
| 111 |
+
<checkout>
|
| 112 |
+
<rewrite>
|
| 113 |
+
<cart_api>Bluefish_Connection_Model_Checkout_Cart_Api</cart_api>
|
| 114 |
+
</rewrite>
|
| 115 |
+
</checkout>
|
| 116 |
+
<cataloginventory>
|
| 117 |
+
<rewrite>
|
| 118 |
+
<stock_item>Bluefish_Connection_Model_CatalogInventory_Stock_Item</stock_item>
|
| 119 |
+
</rewrite>
|
| 120 |
+
</cataloginventory>
|
| 121 |
|
| 122 |
+
<cataloginventory>
|
| 123 |
+
<rewrite>
|
| 124 |
+
<observer>Bluefish_Connection_Model_Observer</observer>
|
| 125 |
+
</rewrite>
|
| 126 |
+
</cataloginventory>
|
| 127 |
+
|
| 128 |
<connection>
|
| 129 |
<class>Bluefish_Connection_Model</class>
|
| 130 |
<resourceModel>connection_mysql4</resourceModel>
|
| 188 |
<crontab>
|
| 189 |
<jobs>
|
| 190 |
<bluefish_connection_category>
|
| 191 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
| 192 |
+
<run><model>connection/cronobserver::categoryImport</model></run>
|
| 193 |
</bluefish_connection_category>
|
| 194 |
<bluefish_connection_product>
|
| 195 |
+
<schedule><cron_expr>55 9 * * *</cron_expr></schedule>
|
| 196 |
+
<run><model>connection/cronobserver::productImport</model></run>
|
| 197 |
</bluefish_connection_product>
|
| 198 |
+
<bluefish_connection_productexport>
|
| 199 |
+
<schedule><cron_expr>55 9 * * *</cron_expr></schedule>
|
| 200 |
+
<run><model>connection/cronobserver::productEmport</model></run>
|
| 201 |
+
</bluefish_connection_productexport>
|
| 202 |
<bluefish_connection_stock>
|
| 203 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
| 204 |
+
<run><model>connection/cronobserver::stockImport</model></run>
|
| 205 |
</bluefish_connection_stock>
|
| 206 |
<bluefish_connection_customer>
|
| 207 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
| 208 |
+
<run><model>connection/cronobserver::customerImport</model></run>
|
| 209 |
</bluefish_connection_customer>
|
| 210 |
<bluefish_connection_customerexport>
|
| 211 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
| 212 |
+
<run><model>connection/cronobserver::customerExport</model></run>
|
| 213 |
</bluefish_connection_customerexport>
|
| 214 |
<bluefish_connection_orderimport>
|
| 215 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
| 216 |
+
<run><model>connection/cronobserver::salesImport</model></run>
|
| 217 |
</bluefish_connection_orderimport>
|
| 218 |
<bluefish_connection_orderexport>
|
| 219 |
+
<schedule><cron_expr>0 0 * * *</cron_expr></schedule>
|
| 220 |
+
<run><model>connection/cronobserver::salesExport</model></run>
|
| 221 |
</bluefish_connection_orderexport>
|
| 222 |
</jobs>
|
| 223 |
</crontab>
|
| 228 |
<mycustom_currentstockversion>0</mycustom_currentstockversion>
|
| 229 |
</mycustom_stock_group>
|
| 230 |
</mycustom_section>
|
| 231 |
+
</default>
|
| 232 |
+
|
| 233 |
+
<default>
|
| 234 |
+
<mycustom_section>
|
| 235 |
+
<mycustom_product_export_group>
|
| 236 |
+
<mycustom_unitofmeasure>EA</mycustom_unitofmeasure>
|
| 237 |
+
</mycustom_product_export_group>
|
| 238 |
+
</mycustom_section>
|
| 239 |
+
</default>
|
| 240 |
+
|
| 241 |
+
<default>
|
| 242 |
+
<mycustom_section>
|
| 243 |
+
<mycustom_product_group>
|
| 244 |
+
<mycustom_currentproductversion>0</mycustom_currentproductversion>
|
| 245 |
+
</mycustom_product_group>
|
| 246 |
+
</mycustom_section>
|
| 247 |
+
</default>
|
| 248 |
|
| 249 |
<default>
|
| 250 |
<mycustom_section>
|
| 275 |
</mycustom_section>
|
| 276 |
</default>
|
| 277 |
|
| 278 |
+
<default>
|
| 279 |
<mycustom_section>
|
| 280 |
<mycustom_taxcode_group>
|
| 281 |
<mycustom_taxrate_first>0.0000</mycustom_taxrate_first>
|
| 282 |
</mycustom_taxcode_group>
|
| 283 |
</mycustom_section>
|
| 284 |
</default>
|
| 285 |
+
<default>
|
| 286 |
<mycustom_section>
|
| 287 |
<mycustom_taxcode_group>
|
| 288 |
<mycustom_taxcode_first>UK0</mycustom_taxcode_first>
|
| 289 |
</mycustom_taxcode_group>
|
| 290 |
</mycustom_section>
|
| 291 |
</default>
|
| 292 |
+
<default>
|
| 293 |
<mycustom_section>
|
| 294 |
<mycustom_taxcode_group>
|
| 295 |
<mycustom_taxrate_second>20.0000</mycustom_taxrate_second>
|
| 296 |
</mycustom_taxcode_group>
|
| 297 |
</mycustom_section>
|
| 298 |
</default>
|
| 299 |
+
<default>
|
| 300 |
<mycustom_section>
|
| 301 |
<mycustom_taxcode_group>
|
| 302 |
<mycustom_taxcode_second>UK1</mycustom_taxcode_second>
|
| 304 |
</mycustom_section>
|
| 305 |
</default>
|
| 306 |
|
| 307 |
+
<default>
|
| 308 |
<mycustom_section>
|
| 309 |
<mycustom_payment_group>
|
| 310 |
<mycustom_payment_checkmo>5</mycustom_payment_checkmo>
|
| 311 |
</mycustom_payment_group>
|
| 312 |
</mycustom_section>
|
| 313 |
</default>
|
| 314 |
+
<default>
|
| 315 |
<mycustom_section>
|
| 316 |
<mycustom_payment_group>
|
| 317 |
<mycustom_payment_cc>11</mycustom_payment_cc>
|
| 327 |
<title>Carrier Title</title>
|
| 328 |
<name>bluestore_no_shipping</name>
|
| 329 |
<price>0.00</price>
|
| 330 |
+
<free_shipping_subtotal>0</free_shipping_subtotal>
|
| 331 |
<specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
|
| 332 |
</bluefish_connection>
|
| 333 |
</carriers>
|
| 334 |
</default>
|
| 335 |
|
| 336 |
+
<default>
|
| 337 |
+
<payment>
|
| 338 |
+
<bluefish_connection>
|
| 339 |
+
<active>1</active>
|
| 340 |
+
<model>connection/paymentmethod</model>
|
| 341 |
+
<order_status>processing</order_status>
|
| 342 |
+
<title>Bluestore Paid</title>
|
| 343 |
+
</bluefish_connection>
|
| 344 |
+
</payment>
|
| 345 |
+
</default>
|
| 346 |
|
| 347 |
</config>
|
app/code/local/Bluefish/Connection/etc/system.xml
CHANGED
|
@@ -10,35 +10,35 @@
|
|
| 10 |
<tab>service</tab>
|
| 11 |
<groups>
|
| 12 |
|
| 13 |
-
|
| 14 |
<label>Categories</label>
|
| 15 |
<sort_order>10</sort_order>
|
| 16 |
<show_in_default>1</show_in_default>
|
| 17 |
<show_in_website>1</show_in_website>
|
| 18 |
<show_in_store>1</show_in_store>
|
| 19 |
<fields>
|
| 20 |
-
|
| 21 |
<label></label>
|
| 22 |
<frontend_model>bluefish_connection_block_cronschedule</frontend_model>
|
| 23 |
-
|
| 24 |
<sort_order>10</sort_order>
|
| 25 |
-
|
| 26 |
<show_in_default>1</show_in_default>
|
| 27 |
<show_in_website>1</show_in_website>
|
| 28 |
<show_in_store>1</show_in_store>
|
| 29 |
</mycustom_category_defaultminuteschedule>
|
| 30 |
|
| 31 |
-
|
| 32 |
-
<label
|
| 33 |
<frontend_model>bluefish_connection_block_databasemapping</frontend_model>
|
| 34 |
-
|
| 35 |
<sort_order>20</sort_order>
|
| 36 |
<show_in_default>1</show_in_default>
|
| 37 |
<show_in_website>1</show_in_website>
|
| 38 |
<show_in_store>1</show_in_store>
|
| 39 |
</mycustom_category_mapping_direct>
|
| 40 |
|
| 41 |
-
|
| 42 |
</mycustom_category_group>
|
| 43 |
|
| 44 |
|
|
@@ -50,46 +50,90 @@
|
|
| 50 |
<show_in_website>1</show_in_website>
|
| 51 |
<show_in_store>1</show_in_store>
|
| 52 |
<fields>
|
| 53 |
-
|
| 54 |
<label></label>
|
| 55 |
<frontend_model>bluefish_connection_block_cronschedule</frontend_model>
|
| 56 |
-
|
| 57 |
<sort_order>2</sort_order>
|
| 58 |
-
|
| 59 |
<show_in_default>1</show_in_default>
|
| 60 |
<show_in_website>1</show_in_website>
|
| 61 |
<show_in_store>1</show_in_store>
|
| 62 |
</mycustom_product_commonschedule>
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
<mycustom_stock_group translate="label">
|
| 76 |
<label>Stock</label>
|
| 77 |
-
<sort_order>
|
| 78 |
<show_in_default>1</show_in_default>
|
| 79 |
<show_in_website>1</show_in_website>
|
| 80 |
<show_in_store>1</show_in_store>
|
| 81 |
<fields>
|
| 82 |
-
|
| 83 |
<label></label>
|
| 84 |
<frontend_model>bluefish_connection_block_cronschedule</frontend_model>
|
| 85 |
-
|
| 86 |
<sort_order>2</sort_order>
|
| 87 |
-
|
| 88 |
<show_in_default>1</show_in_default>
|
| 89 |
<show_in_website>1</show_in_website>
|
| 90 |
<show_in_store>1</show_in_store>
|
| 91 |
</mycustom_stock_commonschedule>
|
| 92 |
-
|
| 93 |
<label>Min Qty to Display as In Stock</label>
|
| 94 |
<frontend_type>text</frontend_type>
|
| 95 |
<sort_order>40</sort_order>
|
|
@@ -97,7 +141,7 @@
|
|
| 97 |
<show_in_website>1</show_in_website>
|
| 98 |
<show_in_store>1</show_in_store>
|
| 99 |
</mycustom_croninstock>
|
| 100 |
-
|
| 101 |
<label>Bluestore Store Code</label>
|
| 102 |
<frontend_type>text</frontend_type>
|
| 103 |
<sort_order>50</sort_order>
|
|
@@ -105,7 +149,7 @@
|
|
| 105 |
<show_in_website>1</show_in_website>
|
| 106 |
<show_in_store>1</show_in_store>
|
| 107 |
</mycustom_bluestorecode>
|
| 108 |
-
|
| 109 |
<label>Current Stock Version</label>
|
| 110 |
<frontend_type>text</frontend_type>
|
| 111 |
<sort_order>60</sort_order>
|
|
@@ -113,32 +157,49 @@
|
|
| 113 |
<show_in_website>1</show_in_website>
|
| 114 |
<show_in_store>1</show_in_store>
|
| 115 |
</mycustom_currentstockversion>
|
| 116 |
-
|
| 117 |
</mycustom_stock_group>
|
| 118 |
|
| 119 |
<mycustom_customer_group translate="label">
|
| 120 |
<label>Customers</label>
|
| 121 |
-
<sort_order>
|
| 122 |
<show_in_default>1</show_in_default>
|
| 123 |
<show_in_website>1</show_in_website>
|
| 124 |
<show_in_store>1</show_in_store>
|
| 125 |
<fields>
|
| 126 |
-
|
| 127 |
<label></label>
|
| 128 |
<frontend_model>bluefish_connection_block_cronschedule</frontend_model>
|
| 129 |
-
|
| 130 |
<sort_order>2</sort_order>
|
| 131 |
-
|
| 132 |
<show_in_default>1</show_in_default>
|
| 133 |
<show_in_website>1</show_in_website>
|
| 134 |
<show_in_store>1</show_in_store>
|
| 135 |
</mycustom_customer_commonschedule>
|
| 136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
</mycustom_customer_group>
|
| 138 |
|
| 139 |
<mycustom_sales_group translate="label">
|
| 140 |
<label>Sales</label>
|
| 141 |
-
<sort_order>
|
| 142 |
<show_in_default>1</show_in_default>
|
| 143 |
<show_in_website>1</show_in_website>
|
| 144 |
<show_in_store>1</show_in_store>
|
|
@@ -177,10 +238,29 @@
|
|
| 177 |
<show_in_website>1</show_in_website>
|
| 178 |
<show_in_store>1</show_in_store>
|
| 179 |
</mycustom_sale_chargescode>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
<mycustom_customer_idimport translate="label">
|
| 181 |
<label>Magento Customer Id for Sales Import</label>
|
| 182 |
<frontend_type>text</frontend_type>
|
| 183 |
-
<sort_order>
|
| 184 |
<show_in_default>1</show_in_default>
|
| 185 |
<show_in_website>1</show_in_website>
|
| 186 |
<show_in_store>1</show_in_store>
|
|
@@ -188,18 +268,36 @@
|
|
| 188 |
<mycustom_bluestore_enddatetime translate="label">
|
| 189 |
<label>Bluestore Last Sale End DateTime</label>
|
| 190 |
<frontend_type>text</frontend_type>
|
| 191 |
-
<sort_order>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
<show_in_default>1</show_in_default>
|
| 193 |
<show_in_website>1</show_in_website>
|
| 194 |
<show_in_store>1</show_in_store>
|
| 195 |
-
</
|
| 196 |
</fields>
|
| 197 |
-
</
|
| 198 |
-
|
| 199 |
-
|
| 200 |
<mycustom_auth_group translate="label">
|
| 201 |
<label>Authentication</label>
|
| 202 |
-
<sort_order>
|
| 203 |
<show_in_default>1</show_in_default>
|
| 204 |
<show_in_website>1</show_in_website>
|
| 205 |
<show_in_store>1</show_in_store>
|
|
@@ -212,7 +310,7 @@
|
|
| 212 |
<show_in_website>1</show_in_website>
|
| 213 |
<show_in_store>1</show_in_store>
|
| 214 |
</mycustom_login>
|
| 215 |
-
|
| 216 |
<label>Magento API Password</label>
|
| 217 |
<frontend_type>password</frontend_type>
|
| 218 |
<sort_order>30</sort_order>
|
|
@@ -220,7 +318,7 @@
|
|
| 220 |
<show_in_website>1</show_in_website>
|
| 221 |
<show_in_store>1</show_in_store>
|
| 222 |
</mycustom_password>
|
| 223 |
-
|
| 224 |
<label>Bluestore API Key</label>
|
| 225 |
<frontend_type>password</frontend_type>
|
| 226 |
<sort_order>40</sort_order>
|
|
@@ -228,7 +326,7 @@
|
|
| 228 |
<show_in_website>1</show_in_website>
|
| 229 |
<show_in_store>1</show_in_store>
|
| 230 |
</mycustom_code>
|
| 231 |
-
|
| 232 |
<label>Bluestore API Token</label>
|
| 233 |
<frontend_type>password</frontend_type>
|
| 234 |
<sort_order>50</sort_order>
|
|
@@ -236,7 +334,7 @@
|
|
| 236 |
<show_in_website>1</show_in_website>
|
| 237 |
<show_in_store>1</show_in_store>
|
| 238 |
</mycustom_codeapitoken>
|
| 239 |
-
|
| 240 |
<label>Authentication Certificate - Private Key</label>
|
| 241 |
<frontend_type>textarea</frontend_type>
|
| 242 |
<sort_order>60</sort_order>
|
|
@@ -244,14 +342,14 @@
|
|
| 244 |
<show_in_website>1</show_in_website>
|
| 245 |
<show_in_store>1</show_in_store>
|
| 246 |
</mycustom_certificate>
|
| 247 |
-
|
| 248 |
</mycustom_auth_group>
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
<mycustom_taxcode_group translate="label">
|
| 253 |
<label>Bluestore Tax Codes</label>
|
| 254 |
-
<sort_order>
|
| 255 |
<show_in_default>1</show_in_default>
|
| 256 |
<show_in_website>1</show_in_website>
|
| 257 |
<show_in_store>1</show_in_store>
|
|
@@ -259,19 +357,19 @@
|
|
| 259 |
<mycustom_taxcode_rates translate="label">
|
| 260 |
<label></label>
|
| 261 |
<frontend_model>bluefish_connection_block_bluestoretaxcode</frontend_model>
|
| 262 |
-
|
| 263 |
<sort_order>2</sort_order>
|
| 264 |
<show_in_default>1</show_in_default>
|
| 265 |
<show_in_website>1</show_in_website>
|
| 266 |
<show_in_store>1</show_in_store>
|
| 267 |
</mycustom_taxcode_rates>
|
| 268 |
-
|
| 269 |
</mycustom_taxcode_group>
|
| 270 |
|
| 271 |
|
| 272 |
<mycustom_payment_group translate="label">
|
| 273 |
<label>Bluestore Payment Method Mapping</label>
|
| 274 |
-
<sort_order>
|
| 275 |
<show_in_default>1</show_in_default>
|
| 276 |
<show_in_website>1</show_in_website>
|
| 277 |
<show_in_store>1</show_in_store>
|
|
@@ -287,9 +385,10 @@
|
|
| 287 |
</mycustom_payment_checkmethod>
|
| 288 |
</fields>
|
| 289 |
</mycustom_payment_group>
|
| 290 |
-
|
|
|
|
| 291 |
<label>Bluestore Product Tax Class</label>
|
| 292 |
-
<sort_order>
|
| 293 |
<show_in_default>1</show_in_default>
|
| 294 |
<show_in_website>1</show_in_website>
|
| 295 |
<show_in_store>1</show_in_store>
|
|
@@ -309,23 +408,23 @@
|
|
| 309 |
</groups>
|
| 310 |
</mycustom_section>
|
| 311 |
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
|
| 330 |
<carriers>
|
| 331 |
<groups>
|
|
@@ -357,15 +456,23 @@
|
|
| 357 |
<name translate="label">
|
| 358 |
<label>Method Name</label>
|
| 359 |
<frontend_type>text</frontend_type>
|
| 360 |
-
<sort_order>
|
| 361 |
<show_in_default>1</show_in_default>
|
| 362 |
<show_in_website>1</show_in_website>
|
| 363 |
<show_in_store>1</show_in_store>
|
| 364 |
</name>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
<price translate="label">
|
| 366 |
<label>Price</label>
|
| 367 |
<frontend_type>text</frontend_type>
|
| 368 |
-
<sort_order>
|
| 369 |
<show_in_default>1</show_in_default>
|
| 370 |
<show_in_website>1</show_in_website>
|
| 371 |
<show_in_store>0</show_in_store>
|
|
@@ -373,7 +480,7 @@
|
|
| 373 |
<specificerrmsg translate="label">
|
| 374 |
<label>Displayed Error Message</label>
|
| 375 |
<frontend_type>textarea</frontend_type>
|
| 376 |
-
<sort_order>
|
| 377 |
<show_in_default>1</show_in_default>
|
| 378 |
<show_in_website>1</show_in_website>
|
| 379 |
<show_in_store>1</show_in_store>
|
|
@@ -381,7 +488,7 @@
|
|
| 381 |
<sallowspecific translate="label">
|
| 382 |
<label>Ship to Applicable Countries</label>
|
| 383 |
<frontend_type>select</frontend_type>
|
| 384 |
-
<sort_order>
|
| 385 |
<frontend_class>shipping-applicable-country</frontend_class>
|
| 386 |
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
| 387 |
<show_in_default>1</show_in_default>
|
|
@@ -391,7 +498,7 @@
|
|
| 391 |
<specificcountry translate="label">
|
| 392 |
<label>Ship to Specific Countries</label>
|
| 393 |
<frontend_type>multiselect</frontend_type>
|
| 394 |
-
<sort_order>
|
| 395 |
<source_model>adminhtml/system_config_source_country</source_model>
|
| 396 |
<show_in_default>1</show_in_default>
|
| 397 |
<show_in_website>1</show_in_website>
|
|
@@ -444,6 +551,5 @@
|
|
| 444 |
</bluefish_connection>
|
| 445 |
</groups>
|
| 446 |
</payment>
|
| 447 |
-
|
| 448 |
</sections>
|
| 449 |
</config>
|
| 10 |
<tab>service</tab>
|
| 11 |
<groups>
|
| 12 |
|
| 13 |
+
<mycustom_category_group translate="label">
|
| 14 |
<label>Categories</label>
|
| 15 |
<sort_order>10</sort_order>
|
| 16 |
<show_in_default>1</show_in_default>
|
| 17 |
<show_in_website>1</show_in_website>
|
| 18 |
<show_in_store>1</show_in_store>
|
| 19 |
<fields>
|
| 20 |
+
<mycustom_category_defaultminuteschedule translate="label">
|
| 21 |
<label></label>
|
| 22 |
<frontend_model>bluefish_connection_block_cronschedule</frontend_model>
|
| 23 |
+
<backend_model>bluefish_connection_model_validationcrontime</backend_model>
|
| 24 |
<sort_order>10</sort_order>
|
| 25 |
+
<comment><![CDATA[Add one or more schedule lines to indicate times during the day when categories will be retrieved from bluestore.]]></comment>
|
| 26 |
<show_in_default>1</show_in_default>
|
| 27 |
<show_in_website>1</show_in_website>
|
| 28 |
<show_in_store>1</show_in_store>
|
| 29 |
</mycustom_category_defaultminuteschedule>
|
| 30 |
|
| 31 |
+
<mycustom_category_mapping_direct translate="label">
|
| 32 |
+
<label>Choose One Option</label>
|
| 33 |
<frontend_model>bluefish_connection_block_databasemapping</frontend_model>
|
| 34 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
| 35 |
<sort_order>20</sort_order>
|
| 36 |
<show_in_default>1</show_in_default>
|
| 37 |
<show_in_website>1</show_in_website>
|
| 38 |
<show_in_store>1</show_in_store>
|
| 39 |
</mycustom_category_mapping_direct>
|
| 40 |
|
| 41 |
+
</fields>
|
| 42 |
</mycustom_category_group>
|
| 43 |
|
| 44 |
|
| 50 |
<show_in_website>1</show_in_website>
|
| 51 |
<show_in_store>1</show_in_store>
|
| 52 |
<fields>
|
| 53 |
+
<mycustom_product_commonschedule translate="label">
|
| 54 |
<label></label>
|
| 55 |
<frontend_model>bluefish_connection_block_cronschedule</frontend_model>
|
| 56 |
+
<backend_model>bluefish_connection_model_validationcrontime</backend_model>
|
| 57 |
<sort_order>2</sort_order>
|
| 58 |
+
<comment><![CDATA[Add one or more schedule lines to indicate times during the day when products will be retrieved from bluestore.]]></comment>
|
| 59 |
<show_in_default>1</show_in_default>
|
| 60 |
<show_in_website>1</show_in_website>
|
| 61 |
<show_in_store>1</show_in_store>
|
| 62 |
</mycustom_product_commonschedule>
|
| 63 |
+
<mycustom_product_mapping_direct translate="label">
|
| 64 |
+
<label>Choose One Option</label>
|
| 65 |
+
<frontend_model>bluefish_connection_block_productdatabasemapping</frontend_model>
|
| 66 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
| 67 |
+
<sort_order>30</sort_order>
|
| 68 |
+
<show_in_default>1</show_in_default>
|
| 69 |
+
<show_in_website>1</show_in_website>
|
| 70 |
+
<show_in_store>1</show_in_store>
|
| 71 |
+
</mycustom_product_mapping_direct>
|
| 72 |
+
<mycustom_currentproductversion translate="label">
|
| 73 |
+
<label>Current Product Version</label>
|
| 74 |
+
<frontend_type>text</frontend_type>
|
| 75 |
+
<sort_order>40</sort_order>
|
| 76 |
+
<show_in_default>1</show_in_default>
|
| 77 |
+
<show_in_website>1</show_in_website>
|
| 78 |
+
<show_in_store>1</show_in_store>
|
| 79 |
+
</mycustom_currentproductversion>
|
| 80 |
+
</fields>
|
| 81 |
+
</mycustom_product_group>
|
| 82 |
+
|
| 83 |
+
<mycustom_product_export_group translate="label">
|
| 84 |
+
<label>Products Export</label>
|
| 85 |
+
<sort_order>30</sort_order>
|
| 86 |
+
<show_in_default>1</show_in_default>
|
| 87 |
+
<show_in_website>1</show_in_website>
|
| 88 |
+
<show_in_store>1</show_in_store>
|
| 89 |
+
<fields>
|
| 90 |
+
<mycustom_product_last_export translate="label">
|
| 91 |
+
<label>Last Export of Product Changes</label>
|
| 92 |
+
<frontend_type>text</frontend_type>
|
| 93 |
+
<sort_order>10</sort_order>
|
| 94 |
+
<comment><![CDATA[(YYYY-MM-DD hh:mm:ss)]]></comment>
|
| 95 |
+
<show_in_default>1</show_in_default>
|
| 96 |
+
<show_in_website>1</show_in_website>
|
| 97 |
+
<show_in_store>1</show_in_store>
|
| 98 |
+
</mycustom_product_last_export>
|
| 99 |
+
<mycustom_unitofmeasure translate="label">
|
| 100 |
+
<label>Default Bluestore Unit of Measure Code</label>
|
| 101 |
+
<frontend_type>text</frontend_type>
|
| 102 |
+
<sort_order>20</sort_order>
|
| 103 |
+
<show_in_default>1</show_in_default>
|
| 104 |
+
<show_in_website>1</show_in_website>
|
| 105 |
+
<show_in_store>1</show_in_store>
|
| 106 |
+
</mycustom_unitofmeasure>
|
| 107 |
+
<mycustom_magento_producttype translate="label">
|
| 108 |
+
<label>Manage Product Types</label>
|
| 109 |
+
<frontend_model>bluefish_connection_block_bluestoreproducttype</frontend_model>
|
| 110 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
| 111 |
+
<sort_order>30</sort_order>
|
| 112 |
+
<show_in_default>1</show_in_default>
|
| 113 |
+
<show_in_website>1</show_in_website>
|
| 114 |
+
<show_in_store>1</show_in_store>
|
| 115 |
+
</mycustom_magento_producttype>
|
| 116 |
+
</fields>
|
| 117 |
+
</mycustom_product_export_group>
|
| 118 |
|
| 119 |
<mycustom_stock_group translate="label">
|
| 120 |
<label>Stock</label>
|
| 121 |
+
<sort_order>40</sort_order>
|
| 122 |
<show_in_default>1</show_in_default>
|
| 123 |
<show_in_website>1</show_in_website>
|
| 124 |
<show_in_store>1</show_in_store>
|
| 125 |
<fields>
|
| 126 |
+
<mycustom_stock_commonschedule translate="label">
|
| 127 |
<label></label>
|
| 128 |
<frontend_model>bluefish_connection_block_cronschedule</frontend_model>
|
| 129 |
+
<backend_model>bluefish_connection_model_validationcrontime</backend_model>
|
| 130 |
<sort_order>2</sort_order>
|
| 131 |
+
<comment><![CDATA[Add one or more schedule lines to indicate times during the day when stock will be retrieved from bluestore.]]></comment>
|
| 132 |
<show_in_default>1</show_in_default>
|
| 133 |
<show_in_website>1</show_in_website>
|
| 134 |
<show_in_store>1</show_in_store>
|
| 135 |
</mycustom_stock_commonschedule>
|
| 136 |
+
<mycustom_croninstock translate="label">
|
| 137 |
<label>Min Qty to Display as In Stock</label>
|
| 138 |
<frontend_type>text</frontend_type>
|
| 139 |
<sort_order>40</sort_order>
|
| 141 |
<show_in_website>1</show_in_website>
|
| 142 |
<show_in_store>1</show_in_store>
|
| 143 |
</mycustom_croninstock>
|
| 144 |
+
<mycustom_bluestorecode translate="label">
|
| 145 |
<label>Bluestore Store Code</label>
|
| 146 |
<frontend_type>text</frontend_type>
|
| 147 |
<sort_order>50</sort_order>
|
| 149 |
<show_in_website>1</show_in_website>
|
| 150 |
<show_in_store>1</show_in_store>
|
| 151 |
</mycustom_bluestorecode>
|
| 152 |
+
<mycustom_currentstockversion translate="label">
|
| 153 |
<label>Current Stock Version</label>
|
| 154 |
<frontend_type>text</frontend_type>
|
| 155 |
<sort_order>60</sort_order>
|
| 157 |
<show_in_website>1</show_in_website>
|
| 158 |
<show_in_store>1</show_in_store>
|
| 159 |
</mycustom_currentstockversion>
|
| 160 |
+
</fields>
|
| 161 |
</mycustom_stock_group>
|
| 162 |
|
| 163 |
<mycustom_customer_group translate="label">
|
| 164 |
<label>Customers</label>
|
| 165 |
+
<sort_order>50</sort_order>
|
| 166 |
<show_in_default>1</show_in_default>
|
| 167 |
<show_in_website>1</show_in_website>
|
| 168 |
<show_in_store>1</show_in_store>
|
| 169 |
<fields>
|
| 170 |
+
<mycustom_customer_commonschedule translate="label">
|
| 171 |
<label></label>
|
| 172 |
<frontend_model>bluefish_connection_block_cronschedule</frontend_model>
|
| 173 |
+
<backend_model>bluefish_connection_model_validationcrontime</backend_model>
|
| 174 |
<sort_order>2</sort_order>
|
| 175 |
+
<comment><![CDATA[Add one or more schedule lines to indicate times during the day when customers will be synchronised with bluestore.]]></comment>
|
| 176 |
<show_in_default>1</show_in_default>
|
| 177 |
<show_in_website>1</show_in_website>
|
| 178 |
<show_in_store>1</show_in_store>
|
| 179 |
</mycustom_customer_commonschedule>
|
| 180 |
+
<mycustom_customer_last_export translate="label">
|
| 181 |
+
<label>Last Export of Customer Changes</label>
|
| 182 |
+
<frontend_type>text</frontend_type>
|
| 183 |
+
<sort_order>3</sort_order>
|
| 184 |
+
<comment><![CDATA[(YYYY-MM-DD hh:mm:ss)]]></comment>
|
| 185 |
+
<show_in_default>1</show_in_default>
|
| 186 |
+
<show_in_website>1</show_in_website>
|
| 187 |
+
<show_in_store>1</show_in_store>
|
| 188 |
+
</mycustom_customer_last_export>
|
| 189 |
+
<mycustom_bluestore_customer_version translate="label">
|
| 190 |
+
<label>Last Bluestore Customer Version Imported</label>
|
| 191 |
+
<frontend_type>text</frontend_type>
|
| 192 |
+
<sort_order>4</sort_order>
|
| 193 |
+
<show_in_default>1</show_in_default>
|
| 194 |
+
<show_in_website>1</show_in_website>
|
| 195 |
+
<show_in_store>1</show_in_store>
|
| 196 |
+
</mycustom_bluestore_customer_version>
|
| 197 |
+
</fields>
|
| 198 |
</mycustom_customer_group>
|
| 199 |
|
| 200 |
<mycustom_sales_group translate="label">
|
| 201 |
<label>Sales</label>
|
| 202 |
+
<sort_order>60</sort_order>
|
| 203 |
<show_in_default>1</show_in_default>
|
| 204 |
<show_in_website>1</show_in_website>
|
| 205 |
<show_in_store>1</show_in_store>
|
| 238 |
<show_in_website>1</show_in_website>
|
| 239 |
<show_in_store>1</show_in_store>
|
| 240 |
</mycustom_sale_chargescode>
|
| 241 |
+
<mycustom_sales_last_export translate="label">
|
| 242 |
+
<label>Last Export of Completed Sales</label>
|
| 243 |
+
<frontend_type>text</frontend_type>
|
| 244 |
+
<sort_order>90</sort_order>
|
| 245 |
+
<comment><![CDATA[(YYYY-MM-DD hh:mm:ss)]]></comment>
|
| 246 |
+
<show_in_default>1</show_in_default>
|
| 247 |
+
<show_in_website>1</show_in_website>
|
| 248 |
+
<show_in_store>1</show_in_store>
|
| 249 |
+
</mycustom_sales_last_export>
|
| 250 |
+
</fields>
|
| 251 |
+
</mycustom_sales_group>
|
| 252 |
+
|
| 253 |
+
<mycustom_sales_import_group translate="label">
|
| 254 |
+
<label>Sales Import</label>
|
| 255 |
+
<sort_order>70</sort_order>
|
| 256 |
+
<show_in_default>1</show_in_default>
|
| 257 |
+
<show_in_website>1</show_in_website>
|
| 258 |
+
<show_in_store>1</show_in_store>
|
| 259 |
+
<fields>
|
| 260 |
<mycustom_customer_idimport translate="label">
|
| 261 |
<label>Magento Customer Id for Sales Import</label>
|
| 262 |
<frontend_type>text</frontend_type>
|
| 263 |
+
<sort_order>10</sort_order>
|
| 264 |
<show_in_default>1</show_in_default>
|
| 265 |
<show_in_website>1</show_in_website>
|
| 266 |
<show_in_store>1</show_in_store>
|
| 268 |
<mycustom_bluestore_enddatetime translate="label">
|
| 269 |
<label>Bluestore Last Sale End DateTime</label>
|
| 270 |
<frontend_type>text</frontend_type>
|
| 271 |
+
<sort_order>20</sort_order>
|
| 272 |
+
<comment><![CDATA[(YYYY-MM-DD hh:mm:ss TZ)]]></comment>
|
| 273 |
+
<show_in_default>1</show_in_default>
|
| 274 |
+
<show_in_website>1</show_in_website>
|
| 275 |
+
<show_in_store>1</show_in_store>
|
| 276 |
+
</mycustom_bluestore_enddatetime>
|
| 277 |
+
<mycustom_sales_mapping_method translate="label">
|
| 278 |
+
<label>Choose One Option For Sale Import</label>
|
| 279 |
+
<frontend_model>bluefish_connection_block_salesmapping</frontend_model>
|
| 280 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
| 281 |
+
<sort_order>30</sort_order>
|
| 282 |
+
<show_in_default>1</show_in_default>
|
| 283 |
+
<show_in_website>1</show_in_website>
|
| 284 |
+
<show_in_store>1</show_in_store>
|
| 285 |
+
</mycustom_sales_mapping_method>
|
| 286 |
+
<mycustom_outofstock_mapping translate="label">
|
| 287 |
+
<label>Import Sale For Out Of Stock Product</label>
|
| 288 |
+
<frontend_model>bluefish_connection_block_outofstocksale</frontend_model>
|
| 289 |
+
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
| 290 |
+
<sort_order>40</sort_order>
|
| 291 |
<show_in_default>1</show_in_default>
|
| 292 |
<show_in_website>1</show_in_website>
|
| 293 |
<show_in_store>1</show_in_store>
|
| 294 |
+
</mycustom_outofstock_mapping>
|
| 295 |
</fields>
|
| 296 |
+
</mycustom_sales_import_group>
|
| 297 |
+
|
|
|
|
| 298 |
<mycustom_auth_group translate="label">
|
| 299 |
<label>Authentication</label>
|
| 300 |
+
<sort_order>80</sort_order>
|
| 301 |
<show_in_default>1</show_in_default>
|
| 302 |
<show_in_website>1</show_in_website>
|
| 303 |
<show_in_store>1</show_in_store>
|
| 310 |
<show_in_website>1</show_in_website>
|
| 311 |
<show_in_store>1</show_in_store>
|
| 312 |
</mycustom_login>
|
| 313 |
+
<mycustom_password translate="label">
|
| 314 |
<label>Magento API Password</label>
|
| 315 |
<frontend_type>password</frontend_type>
|
| 316 |
<sort_order>30</sort_order>
|
| 318 |
<show_in_website>1</show_in_website>
|
| 319 |
<show_in_store>1</show_in_store>
|
| 320 |
</mycustom_password>
|
| 321 |
+
<mycustom_code translate="label">
|
| 322 |
<label>Bluestore API Key</label>
|
| 323 |
<frontend_type>password</frontend_type>
|
| 324 |
<sort_order>40</sort_order>
|
| 326 |
<show_in_website>1</show_in_website>
|
| 327 |
<show_in_store>1</show_in_store>
|
| 328 |
</mycustom_code>
|
| 329 |
+
<mycustom_codeapitoken translate="label">
|
| 330 |
<label>Bluestore API Token</label>
|
| 331 |
<frontend_type>password</frontend_type>
|
| 332 |
<sort_order>50</sort_order>
|
| 334 |
<show_in_website>1</show_in_website>
|
| 335 |
<show_in_store>1</show_in_store>
|
| 336 |
</mycustom_codeapitoken>
|
| 337 |
+
<mycustom_certificate translate="label">
|
| 338 |
<label>Authentication Certificate - Private Key</label>
|
| 339 |
<frontend_type>textarea</frontend_type>
|
| 340 |
<sort_order>60</sort_order>
|
| 342 |
<show_in_website>1</show_in_website>
|
| 343 |
<show_in_store>1</show_in_store>
|
| 344 |
</mycustom_certificate>
|
| 345 |
+
</fields>
|
| 346 |
</mycustom_auth_group>
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
<mycustom_taxcode_group translate="label">
|
| 351 |
<label>Bluestore Tax Codes</label>
|
| 352 |
+
<sort_order>90</sort_order>
|
| 353 |
<show_in_default>1</show_in_default>
|
| 354 |
<show_in_website>1</show_in_website>
|
| 355 |
<show_in_store>1</show_in_store>
|
| 357 |
<mycustom_taxcode_rates translate="label">
|
| 358 |
<label></label>
|
| 359 |
<frontend_model>bluefish_connection_block_bluestoretaxcode</frontend_model>
|
| 360 |
+
<backend_model>bluefish_connection_model_validationtaxcode</backend_model>
|
| 361 |
<sort_order>2</sort_order>
|
| 362 |
<show_in_default>1</show_in_default>
|
| 363 |
<show_in_website>1</show_in_website>
|
| 364 |
<show_in_store>1</show_in_store>
|
| 365 |
</mycustom_taxcode_rates>
|
| 366 |
+
</fields>
|
| 367 |
</mycustom_taxcode_group>
|
| 368 |
|
| 369 |
|
| 370 |
<mycustom_payment_group translate="label">
|
| 371 |
<label>Bluestore Payment Method Mapping</label>
|
| 372 |
+
<sort_order>100</sort_order>
|
| 373 |
<show_in_default>1</show_in_default>
|
| 374 |
<show_in_website>1</show_in_website>
|
| 375 |
<show_in_store>1</show_in_store>
|
| 385 |
</mycustom_payment_checkmethod>
|
| 386 |
</fields>
|
| 387 |
</mycustom_payment_group>
|
| 388 |
+
|
| 389 |
+
<mycustom_taxclass_group translate="label">
|
| 390 |
<label>Bluestore Product Tax Class</label>
|
| 391 |
+
<sort_order>110</sort_order>
|
| 392 |
<show_in_default>1</show_in_default>
|
| 393 |
<show_in_website>1</show_in_website>
|
| 394 |
<show_in_store>1</show_in_store>
|
| 408 |
</groups>
|
| 409 |
</mycustom_section>
|
| 410 |
|
| 411 |
+
<system>
|
| 412 |
+
<groups>
|
| 413 |
+
<cron translate="label comment" module="cron">
|
| 414 |
+
<fields>
|
| 415 |
+
<disabled_crons translate="label">
|
| 416 |
+
<label>Disabled cron tasks</label>
|
| 417 |
+
<frontend_type>text</frontend_type>
|
| 418 |
+
<comment><![CDATA[Do not edit this field manually.]]></comment>
|
| 419 |
+
<sort_order>100</sort_order>
|
| 420 |
+
<show_in_default>1</show_in_default>
|
| 421 |
+
<show_in_website>0</show_in_website>
|
| 422 |
+
<show_in_store>0</show_in_store>
|
| 423 |
+
</disabled_crons>
|
| 424 |
+
</fields>
|
| 425 |
+
</cron>
|
| 426 |
+
</groups>
|
| 427 |
+
</system>
|
| 428 |
|
| 429 |
<carriers>
|
| 430 |
<groups>
|
| 456 |
<name translate="label">
|
| 457 |
<label>Method Name</label>
|
| 458 |
<frontend_type>text</frontend_type>
|
| 459 |
+
<sort_order>3</sort_order>
|
| 460 |
<show_in_default>1</show_in_default>
|
| 461 |
<show_in_website>1</show_in_website>
|
| 462 |
<show_in_store>1</show_in_store>
|
| 463 |
</name>
|
| 464 |
+
<free_shipping_subtotal translate="label">
|
| 465 |
+
<label>Minimum order amount</label>
|
| 466 |
+
<frontend_type>text</frontend_type>
|
| 467 |
+
<sort_order>4</sort_order>
|
| 468 |
+
<show_in_default>1</show_in_default>
|
| 469 |
+
<show_in_website>1</show_in_website>
|
| 470 |
+
<show_in_store>1</show_in_store>
|
| 471 |
+
</free_shipping_subtotal>
|
| 472 |
<price translate="label">
|
| 473 |
<label>Price</label>
|
| 474 |
<frontend_type>text</frontend_type>
|
| 475 |
+
<sort_order>5</sort_order>
|
| 476 |
<show_in_default>1</show_in_default>
|
| 477 |
<show_in_website>1</show_in_website>
|
| 478 |
<show_in_store>0</show_in_store>
|
| 480 |
<specificerrmsg translate="label">
|
| 481 |
<label>Displayed Error Message</label>
|
| 482 |
<frontend_type>textarea</frontend_type>
|
| 483 |
+
<sort_order>6</sort_order>
|
| 484 |
<show_in_default>1</show_in_default>
|
| 485 |
<show_in_website>1</show_in_website>
|
| 486 |
<show_in_store>1</show_in_store>
|
| 488 |
<sallowspecific translate="label">
|
| 489 |
<label>Ship to Applicable Countries</label>
|
| 490 |
<frontend_type>select</frontend_type>
|
| 491 |
+
<sort_order>7</sort_order>
|
| 492 |
<frontend_class>shipping-applicable-country</frontend_class>
|
| 493 |
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
| 494 |
<show_in_default>1</show_in_default>
|
| 498 |
<specificcountry translate="label">
|
| 499 |
<label>Ship to Specific Countries</label>
|
| 500 |
<frontend_type>multiselect</frontend_type>
|
| 501 |
+
<sort_order>8</sort_order>
|
| 502 |
<source_model>adminhtml/system_config_source_country</source_model>
|
| 503 |
<show_in_default>1</show_in_default>
|
| 504 |
<show_in_website>1</show_in_website>
|
| 551 |
</bluefish_connection>
|
| 552 |
</groups>
|
| 553 |
</payment>
|
|
|
|
| 554 |
</sections>
|
| 555 |
</config>
|
app/design/adminhtml/default/default/template/connection/array_dropdown.phtml
CHANGED
|
@@ -48,15 +48,16 @@ switch ($blockElement) {
|
|
| 48 |
case (stristr($blockElement, "mycustom_chargecode_group") == true):
|
| 49 |
$blockName = "mycustom_chargecode_group";
|
| 50 |
$categoryDefaultTime = Array("Fixed amount::1","Percentage::2");
|
| 51 |
-
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
}
|
| 53 |
|
| 54 |
-
|
| 55 |
-
$
|
| 56 |
-
|
| 57 |
-
$resultPath = $connection->query("select value from ".$prefix."core_config_data WHERE path = 'mycustom_section/mycustom_auth_group/mycustom_login'");
|
| 58 |
-
$resultCronPath = $resultPath->fetchAll(PDO::FETCH_ASSOC);
|
| 59 |
-
$numberRows = count($resultCronPath);
|
| 60 |
?>
|
| 61 |
|
| 62 |
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
|
@@ -239,12 +240,26 @@ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
|
|
| 239 |
arrayRow<?php echo $_htmlId ?>.add('', '','');
|
| 240 |
});
|
| 241 |
|
| 242 |
-
<?php if (!$this->getArrayRows() && ($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
Event.observe(window, 'load', function () {
|
| 244 |
$('grid<?php echo $_htmlId ?>').show();
|
| 245 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 246 |
|
| 247 |
<?php
|
|
|
|
| 248 |
for($i=0;$i<count($categoryDefaultTime);$i++)
|
| 249 |
{
|
| 250 |
?>
|
|
@@ -252,7 +267,7 @@ Event.observe(window, 'load', function () {
|
|
| 252 |
<?php
|
| 253 |
} ?>
|
| 254 |
});
|
| 255 |
-
<?php } elseif (!$this->getArrayRows() && ($
|
| 256 |
Event.observe(window, 'load', function () {
|
| 257 |
$('grid<?php echo $_htmlId ?>').show();
|
| 258 |
$('empty<?php echo $_htmlId ?>').hide();
|
|
@@ -266,7 +281,7 @@ Event.observe(window, 'load', function () {
|
|
| 266 |
<?php
|
| 267 |
} ?>
|
| 268 |
});
|
| 269 |
-
<?php } elseif (!$this->getArrayRows() && ($
|
| 270 |
Event.observe(window, 'load', function () {
|
| 271 |
$('grid<?php echo $_htmlId ?>').show();
|
| 272 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 48 |
case (stristr($blockElement, "mycustom_chargecode_group") == true):
|
| 49 |
$blockName = "mycustom_chargecode_group";
|
| 50 |
$categoryDefaultTime = Array("Fixed amount::1","Percentage::2");
|
| 51 |
+
break;
|
| 52 |
+
case (stristr($blockElement, "mycustom_magento_producttype") == true):
|
| 53 |
+
$blockName = "mycustom_magento_producttype";
|
| 54 |
+
$categoryDefaultTime = Array("simple::Standard","grouped::Service","configurable::Service","virtual::Service","bundle::Service","downloadable::Service");
|
| 55 |
+
break;
|
| 56 |
}
|
| 57 |
|
| 58 |
+
|
| 59 |
+
$credentialsLogin = Mage::getStoreConfig('mycustom_section/mycustom_auth_group');
|
| 60 |
+
$loginFlag = $credentialsLogin['mycustom_login'];
|
|
|
|
|
|
|
|
|
|
| 61 |
?>
|
| 62 |
|
| 63 |
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
| 240 |
arrayRow<?php echo $_htmlId ?>.add('', '','');
|
| 241 |
});
|
| 242 |
|
| 243 |
+
<?php if (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_payment_group")) { ?>
|
| 244 |
+
Event.observe(window, 'load', function () {
|
| 245 |
+
$('grid<?php echo $_htmlId ?>').show();
|
| 246 |
+
$('empty<?php echo $_htmlId ?>').hide();
|
| 247 |
+
|
| 248 |
+
<?php
|
| 249 |
+
for($i=0;$i<count($categoryDefaultTime);$i++)
|
| 250 |
+
{
|
| 251 |
+
?>
|
| 252 |
+
arrayRow<?php echo $_htmlId ?>.add('', '','<?php echo $categoryDefaultTime[$i] ?>');
|
| 253 |
+
<?php
|
| 254 |
+
} ?>
|
| 255 |
+
});
|
| 256 |
+
<?php } elseif (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_taxcode_group")){?>
|
| 257 |
Event.observe(window, 'load', function () {
|
| 258 |
$('grid<?php echo $_htmlId ?>').show();
|
| 259 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 260 |
|
| 261 |
<?php
|
| 262 |
+
|
| 263 |
for($i=0;$i<count($categoryDefaultTime);$i++)
|
| 264 |
{
|
| 265 |
?>
|
| 267 |
<?php
|
| 268 |
} ?>
|
| 269 |
});
|
| 270 |
+
<?php } elseif (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_chargecode_group")){?>
|
| 271 |
Event.observe(window, 'load', function () {
|
| 272 |
$('grid<?php echo $_htmlId ?>').show();
|
| 273 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 281 |
<?php
|
| 282 |
} ?>
|
| 283 |
});
|
| 284 |
+
<?php } elseif (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_magento_producttype")){?>
|
| 285 |
Event.observe(window, 'load', function () {
|
| 286 |
$('grid<?php echo $_htmlId ?>').show();
|
| 287 |
$('empty<?php echo $_htmlId ?>').hide();
|
app/design/adminhtml/default/default/template/connection/cronschedule.phtml
CHANGED
|
@@ -58,14 +58,9 @@ switch ($blockElement) {
|
|
| 58 |
$categoryDefaultTime = Array("*::45");
|
| 59 |
break;
|
| 60 |
}
|
| 61 |
-
|
| 62 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 63 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 64 |
-
|
| 65 |
-
$resultPath = $connection->query("select value from ".$prefix."core_config_data WHERE path = 'mycustom_section/mycustom_auth_group/mycustom_login'");
|
| 66 |
-
$resultCronPath = $resultPath->fetchAll(PDO::FETCH_ASSOC);
|
| 67 |
-
$numberRows = count($resultCronPath);
|
| 68 |
|
|
|
|
|
|
|
| 69 |
?>
|
| 70 |
|
| 71 |
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
|
@@ -228,7 +223,7 @@ Event.observe('emptyAddBtn<?php echo $_htmlId ?>', 'click', function () {
|
|
| 228 |
arrayRow<?php echo $_htmlId ?>.add('', '','');
|
| 229 |
});
|
| 230 |
|
| 231 |
-
<?php if (!$this->getArrayRows() && ($
|
| 232 |
Event.observe(window, 'load', function () {
|
| 233 |
$('grid<?php echo $_htmlId ?>').show();
|
| 234 |
$('empty<?php echo $_htmlId ?>').hide();
|
|
@@ -241,7 +236,7 @@ Event.observe(window, 'load', function () {
|
|
| 241 |
<?php
|
| 242 |
} ?>
|
| 243 |
});
|
| 244 |
-
<?php } elseif (!$this->getArrayRows() && ($
|
| 245 |
Event.observe(window, 'load', function () {
|
| 246 |
$('grid<?php echo $_htmlId ?>').show();
|
| 247 |
$('empty<?php echo $_htmlId ?>').hide();
|
|
@@ -255,7 +250,7 @@ Event.observe(window, 'load', function () {
|
|
| 255 |
<?php
|
| 256 |
} ?>
|
| 257 |
});
|
| 258 |
-
<?php } elseif (!$this->getArrayRows() && ($
|
| 259 |
Event.observe(window, 'load', function () {
|
| 260 |
$('grid<?php echo $_htmlId ?>').show();
|
| 261 |
$('empty<?php echo $_htmlId ?>').hide();
|
|
@@ -269,7 +264,7 @@ Event.observe(window, 'load', function () {
|
|
| 269 |
<?php
|
| 270 |
} ?>
|
| 271 |
});
|
| 272 |
-
<?php } elseif (!$this->getArrayRows() && ($
|
| 273 |
Event.observe(window, 'load', function () {
|
| 274 |
$('grid<?php echo $_htmlId ?>').show();
|
| 275 |
$('empty<?php echo $_htmlId ?>').hide();
|
|
@@ -283,7 +278,7 @@ Event.observe(window, 'load', function () {
|
|
| 283 |
<?php
|
| 284 |
} ?>
|
| 285 |
});
|
| 286 |
-
<?php } elseif (!$this->getArrayRows() && ($
|
| 287 |
Event.observe(window, 'load', function () {
|
| 288 |
$('grid<?php echo $_htmlId ?>').show();
|
| 289 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 58 |
$categoryDefaultTime = Array("*::45");
|
| 59 |
break;
|
| 60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
$credentialsLogin = Mage::getStoreConfig('mycustom_section/mycustom_auth_group');
|
| 63 |
+
$loginFlag = $credentialsLogin['mycustom_login'];
|
| 64 |
?>
|
| 65 |
|
| 66 |
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
| 223 |
arrayRow<?php echo $_htmlId ?>.add('', '','');
|
| 224 |
});
|
| 225 |
|
| 226 |
+
<?php if (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_category_group")) { ?>
|
| 227 |
Event.observe(window, 'load', function () {
|
| 228 |
$('grid<?php echo $_htmlId ?>').show();
|
| 229 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 236 |
<?php
|
| 237 |
} ?>
|
| 238 |
});
|
| 239 |
+
<?php } elseif (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_product_group")){?>
|
| 240 |
Event.observe(window, 'load', function () {
|
| 241 |
$('grid<?php echo $_htmlId ?>').show();
|
| 242 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 250 |
<?php
|
| 251 |
} ?>
|
| 252 |
});
|
| 253 |
+
<?php } elseif (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_stock_group")){?>
|
| 254 |
Event.observe(window, 'load', function () {
|
| 255 |
$('grid<?php echo $_htmlId ?>').show();
|
| 256 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 264 |
<?php
|
| 265 |
} ?>
|
| 266 |
});
|
| 267 |
+
<?php } elseif (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_customer_group")){?>
|
| 268 |
Event.observe(window, 'load', function () {
|
| 269 |
$('grid<?php echo $_htmlId ?>').show();
|
| 270 |
$('empty<?php echo $_htmlId ?>').hide();
|
| 278 |
<?php
|
| 279 |
} ?>
|
| 280 |
});
|
| 281 |
+
<?php } elseif (!$this->getArrayRows() && ($loginFlag == "") && ($blockName == "mycustom_sales_group")){?>
|
| 282 |
Event.observe(window, 'load', function () {
|
| 283 |
$('grid<?php echo $_htmlId ?>').show();
|
| 284 |
$('empty<?php echo $_htmlId ?>').hide();
|
app/design/adminhtml/default/default/template/connection/custom_product_radioinput.phtml
CHANGED
|
@@ -35,17 +35,6 @@ if (!$this->_addAfter) {
|
|
| 35 |
$_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
|
| 36 |
$url = $this->getUrl('bluefish/adminhtml_productdata');
|
| 37 |
|
| 38 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 39 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 40 |
-
|
| 41 |
-
$resultPath = $connection->query("select value from ".$prefix."core_config_data WHERE path = 'mycustom_section/mycustom_product_group/mycustom_product_mapping_direct'");
|
| 42 |
-
$resultCronPath = $resultPath->fetchAll(PDO::FETCH_ASSOC);
|
| 43 |
-
$numberRows = count($resultCronPath);
|
| 44 |
-
|
| 45 |
-
if($numberRows > 0)
|
| 46 |
-
{
|
| 47 |
-
$unserielVal = unserialize($resultCronPath[0]['value']);
|
| 48 |
-
}
|
| 49 |
?>
|
| 50 |
|
| 51 |
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
| 35 |
$_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
|
| 36 |
$url = $this->getUrl('bluefish/adminhtml_productdata');
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
?>
|
| 39 |
|
| 40 |
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
app/design/adminhtml/default/default/template/connection/custom_radioinput.phtml
CHANGED
|
@@ -33,19 +33,7 @@ if (!$this->_addAfter) {
|
|
| 33 |
$_colspan -= 1;
|
| 34 |
}
|
| 35 |
$_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
|
| 36 |
-
$url = $this->getUrl('bluefish/adminhtml_categorydata');
|
| 37 |
-
|
| 38 |
-
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
| 39 |
-
$prefix = Mage::getConfig()->getTablePrefix();
|
| 40 |
-
|
| 41 |
-
$resultPath = $connection->query("select value from ".$prefix."core_config_data WHERE path = 'mycustom_section/mycustom_category_group/mycustom_category_mapping_direct'");
|
| 42 |
-
$resultCronPath = $resultPath->fetchAll(PDO::FETCH_ASSOC);
|
| 43 |
-
$numberRows = count($resultCronPath);
|
| 44 |
-
|
| 45 |
-
if($numberRows > 0)
|
| 46 |
-
{
|
| 47 |
-
$unserielVal = unserialize($resultCronPath[0]['value']);
|
| 48 |
-
}
|
| 49 |
?>
|
| 50 |
|
| 51 |
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
| 33 |
$_colspan -= 1;
|
| 34 |
}
|
| 35 |
$_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
|
| 36 |
+
$url = $this->getUrl('bluefish/adminhtml_categorydata');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
?>
|
| 38 |
|
| 39 |
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
app/design/adminhtml/default/default/template/connection/myformexport.phtml
CHANGED
|
@@ -22,19 +22,23 @@ function checkForm(form)
|
|
| 22 |
<form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/post')?>">
|
| 23 |
|
| 24 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
| 25 |
-
|
| 26 |
<h4 style="color: white; margin-left: 20px; padding: 8px 0px 0px;"><?php echo $this->__('Export')?></h4>
|
| 27 |
<fieldset id="my-fieldset" style="background:white;">
|
| 28 |
<table cellspacing="0" class="form-list">
|
| 29 |
-
|
| 30 |
<td class="label"><?php echo $this->__('Customers')?> </td>
|
| 31 |
<td class="input-ele"> <button onclick="return checkForm(this);" class="scalable save" value="6" type="button"><span>Export</span></button></td>
|
| 32 |
</tr>
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
<td class="label"><?php echo $this->__('Completed Sales')?> </td>
|
| 35 |
<td class="input-ele"> <button onclick="return checkForm(this);" class="scalable save" value="5" type="button"><span>Export</span></button></td>
|
| 36 |
</tr>
|
| 37 |
-
|
| 38 |
<i>Bluestore Data Exchange is configured in System - Configuration under Services - Bluestore Live.</i>
|
| 39 |
</fieldset>
|
| 40 |
</form>
|
| 22 |
<form id="edit_form" name="edit_form" method="post" action="<?php echo $this->getUrl('*/*/post')?>">
|
| 23 |
|
| 24 |
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
| 25 |
+
<input name="button_name" type="hidden" value="" />
|
| 26 |
<h4 style="color: white; margin-left: 20px; padding: 8px 0px 0px;"><?php echo $this->__('Export')?></h4>
|
| 27 |
<fieldset id="my-fieldset" style="background:white;">
|
| 28 |
<table cellspacing="0" class="form-list">
|
| 29 |
+
<tr>
|
| 30 |
<td class="label"><?php echo $this->__('Customers')?> </td>
|
| 31 |
<td class="input-ele"> <button onclick="return checkForm(this);" class="scalable save" value="6" type="button"><span>Export</span></button></td>
|
| 32 |
</tr>
|
| 33 |
+
<tr>
|
| 34 |
+
<td class="label"><?php echo $this->__('Products')?> </td>
|
| 35 |
+
<td class="input-ele"> <button onclick="return checkForm(this);" class="scalable save" value="9" type="button"><span>Export</span></button></td>
|
| 36 |
+
</tr>
|
| 37 |
+
<tr>
|
| 38 |
<td class="label"><?php echo $this->__('Completed Sales')?> </td>
|
| 39 |
<td class="input-ele"> <button onclick="return checkForm(this);" class="scalable save" value="5" type="button"><span>Export</span></button></td>
|
| 40 |
</tr>
|
| 41 |
+
</table>
|
| 42 |
<i>Bluestore Data Exchange is configured in System - Configuration under Services - Bluestore Live.</i>
|
| 43 |
</fieldset>
|
| 44 |
</form>
|
app/design/adminhtml/default/default/template/connection/outofstocksale.phtml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package default_default
|
| 23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
|
| 28 |
+
<?php
|
| 29 |
+
$_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
|
| 30 |
+
|
| 31 |
+
$_colspan = 2;
|
| 32 |
+
if (!$this->_addAfter) {
|
| 33 |
+
$_colspan -= 1;
|
| 34 |
+
}
|
| 35 |
+
$_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
|
| 36 |
+
?>
|
| 37 |
+
|
| 38 |
+
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
| 39 |
+
<table cellpadding="0" cellspacing="0" class="border">
|
| 40 |
+
<tbody>
|
| 41 |
+
|
| 42 |
+
<tr class="headings" id="headings<?php echo $_htmlId ?>">
|
| 43 |
+
<?php foreach ($this->_columns as $columnName => $column):?>
|
| 44 |
+
<th><?php echo $column['label'] ?></th>
|
| 45 |
+
<?php endforeach;?>
|
| 46 |
+
</tr>
|
| 47 |
+
|
| 48 |
+
<tr>
|
| 49 |
+
<?php foreach ($this->_columns as $columnName => $column):?>
|
| 50 |
+
<td class="#{_id}-<?php echo $columnName?>">
|
| 51 |
+
<?php echo $this->_renderCellTemplate($columnName)?>
|
| 52 |
+
</td>
|
| 53 |
+
<?php endforeach;?>
|
| 54 |
+
</tr>
|
| 55 |
+
</tbody>
|
| 56 |
+
|
| 57 |
+
</table>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
|
app/design/adminhtml/default/default/template/connection/salesmapping_radioinput.phtml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
| 11 |
+
* If you did not receive a copy of the license and are unable to
|
| 12 |
+
* obtain it through the world-wide-web, please send an email
|
| 13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 14 |
+
*
|
| 15 |
+
* DISCLAIMER
|
| 16 |
+
*
|
| 17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 18 |
+
* versions in the future. If you wish to customize Magento for your
|
| 19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package default_default
|
| 23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
|
| 28 |
+
<?php
|
| 29 |
+
$_htmlId = $this->getHtmlId() ? $this->getHtmlId() : '_' . uniqid();
|
| 30 |
+
|
| 31 |
+
$_colspan = 2;
|
| 32 |
+
if (!$this->_addAfter) {
|
| 33 |
+
$_colspan -= 1;
|
| 34 |
+
}
|
| 35 |
+
$_colspan = $_colspan > 1 ? 'colspan="' . $_colspan . '"' : '';
|
| 36 |
+
?>
|
| 37 |
+
|
| 38 |
+
<div class="grid" id="grid<?php echo $_htmlId ?>">
|
| 39 |
+
<table cellpadding="0" cellspacing="0" class="border">
|
| 40 |
+
<tbody>
|
| 41 |
+
|
| 42 |
+
<tr class="headings" id="headings<?php echo $_htmlId ?>">
|
| 43 |
+
<?php foreach ($this->_columns as $columnName => $column):?>
|
| 44 |
+
<th><?php echo $column['label'] ?></th>
|
| 45 |
+
<?php endforeach;?>
|
| 46 |
+
</tr>
|
| 47 |
+
|
| 48 |
+
<tr>
|
| 49 |
+
<?php foreach ($this->_columns as $columnName => $column):?>
|
| 50 |
+
<td class="#{_id}-<?php echo $columnName?>">
|
| 51 |
+
<?php echo $this->_renderCellTemplate($columnName)?>
|
| 52 |
+
</td>
|
| 53 |
+
<?php endforeach;?>
|
| 54 |
+
</tr>
|
| 55 |
+
</tbody>
|
| 56 |
+
|
| 57 |
+
</table>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
|
app/etc/modules/Bluefish_Connection.xml
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
<Bluefish_Connection>
|
| 5 |
<active>true</active>
|
| 6 |
<codePool>local</codePool>
|
| 7 |
-
<version>1.1.
|
| 8 |
</Bluefish_Connection>
|
| 9 |
</modules>
|
| 10 |
</config>
|
| 4 |
<Bluefish_Connection>
|
| 5 |
<active>true</active>
|
| 6 |
<codePool>local</codePool>
|
| 7 |
+
<version>1.1.4</version>
|
| 8 |
</Bluefish_Connection>
|
| 9 |
</modules>
|
| 10 |
</config>
|
package.xml
CHANGED
|
@@ -1,26 +1,27 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Bluefish_Connection</name>
|
| 4 |
-
<version>1.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Integrate Magento with Bluestore Live POS. Bring your online and real world shop together - categories, products, customers, inventory and sales.</summary>
|
| 10 |
-
<description
|
| 11 |

|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
<notes>This extension can be used by the users of bluefishretail,by providing appropriate credentials,given to them by bluefishretail.</notes>
|
| 20 |
<authors><author><name>JDoyle</name><user>jdoyle</user><email>jdoyle@bluefishretail.com</email></author></authors>
|
| 21 |
-
<date>2014-
|
| 22 |
-
<time>14:
|
| 23 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Bluefish_Connection.xml" hash="
|
| 24 |
<compatible/>
|
| 25 |
<dependencies><required><php><min>5.1.0</min><max>5.6.0</max></php></required></dependencies>
|
| 26 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Bluefish_Connection</name>
|
| 4 |
+
<version>1.1.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>Integrate Magento with Bluestore Live POS. Bring your online and real world shop together - categories, products, customers, inventory and sales.</summary>
|
| 10 |
+
<description>*****Bluestore Live is the ONLY pos solution that offers full, two way integration with Magento*****
|
| 11 |

|
| 12 |
+
Combine your ecommerce sales channel with your bricks and mortar store point of sale. 
|
| 13 |
+

|
| 14 |
+
Connect your Magento store (existing or new) to your Bluestore Live POS using this free extension. Send category, product and customer information between Bluestore Live and Magento - Completed online sales are passed back to Bluestore Live and recorded with your POS sales so you can see your full business statistics in the Bluestore Live console. OR if you want to continue your business processes using Magento as the master and Bluestore as the slave system, then send completed sales and customer data from Bluestore to Magento.
|
| 15 |
+

|
| 16 |
+
Installation and setup information can be found on our knowledgebase here:
|
| 17 |
+
http://support.bluefishretail.com/entries/30115203-Installation-and-set-up
|
| 18 |
+

|
| 19 |
+
We are on hand to help you get setup, contact us through our website www.bluefishretail.com</description>
|
| 20 |
<notes>This extension can be used by the users of bluefishretail,by providing appropriate credentials,given to them by bluefishretail.</notes>
|
| 21 |
<authors><author><name>JDoyle</name><user>jdoyle</user><email>jdoyle@bluefishretail.com</email></author></authors>
|
| 22 |
+
<date>2014-12-18</date>
|
| 23 |
+
<time>14:05:15</time>
|
| 24 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Bluefish_Connection.xml" hash="d7c5ec7ed43eb33ef3ecae13b6c3f4f5"/></dir></target><target name="magelocal"><dir name="Bluefish"><dir name="Connection"><dir name="Block"><dir name="Adminhtml"><dir name="Bluestorecron"><file name="Grid.php" hash="607f11628693a178bf3b24a1fa00d186"/></dir><file name="Bluestorecron.php" hash="9ed58d66971718270d9bedffe3f577fa"/><dir name="Bluestorescheduler"><file name="Grid.php" hash="5c86b64f9af2a02ea9e9a64111274b72"/></dir><file name="Bluestorescheduler.php" hash="15aaa462a00aea87da5c7606767c7d26"/><dir name="Errorsaleimport"><file name="Grid.php" hash="a70ff1d4899e013d7c08480f15be87e7"/></dir><file name="Errorsaleimport.php" hash="3968634c28963ec4f87854b1dfbcbbf1"/></dir><file name="Bluestoreproducttype.php" hash="4ea7535123b172c7467b66134d08f167"/><file name="Bluestoretaxclass.php" hash="d1777a291e91fef8d23ace0de9e68921"/><file name="Bluestoretaxcode.php" hash="a969e969aab9846a9019072162d215ab"/><file name="Cronschedule.php" hash="4062fd7c8fac5605670b559734767188"/><file name="Databasemapping.php" hash="e1f41279da9fbb1a79eb5184a5ee769e"/><file name="Outofstocksale.php" hash="7e0d652af931910dff6d808ce3295dd7"/><file name="Paymentmethodcode.php" hash="fd4c33ee96330ee1d75841aa09de8774"/><file name="Productdatabasemapping.php" hash="946ad48493133aecf13adc56a6a8f389"/><file name="Salesmapping.php" hash="a842151ccde98cd5bd072038925872c6"/></dir><dir name="Helper"><file name="Data.php" hash="2cd2e9cf9728228d68be3280bbebf7ff"/></dir><dir name="Model"><file name="Bluestoreschedule.php" hash="840d1c3dadd60eeb4787a43b4d870d66"/><dir name="Carrier"><file name="Bsaleshippingmethod.php" hash="8586350fc9ca245ee23af8ab7cb3f264"/></dir><dir name="CatalogInventory"><dir name="Stock"><file name="Item.php" hash="fac3729dd265ce1857e03c4c2e2f5f94"/></dir></dir><dir name="Checkout"><dir name="Cart"><file name="Api.php" hash="031771c7af6a9ac668e6a545957bdeeb"/></dir></dir><dir name="Collection"><file name="Crons.php" hash="86aba02a88fc122f9641c89a4fcd434c"/></dir><file name="Configuration.php" hash="7dd9b00e905b7f260c4a9becc82438ff"/><file name="Connection.php" hash="76da5fa34acfb6294ca712e76b22e223"/><file name="Cronobserver.php" hash="2f84a301ec60018a19c7653c9aa83385"/><file name="Errorsaleimport.php" hash="a332ee81b77c2852ce50743b2f5dfcd1"/><dir name="Mysql4"><dir name="Connection"><file name="Collection.php" hash="0c9166e76131a7092872871b2444754b"/></dir><file name="Connection.php" hash="2c982c25bb2dc863a2693433063a0050"/><dir name="Errorsaleimport"><file name="Collection.php" hash="2717a8f56f9bdef64543bfb1ae6d094c"/></dir><file name="Errorsaleimport.php" hash="3aa550d191ae384d7d263b27e6118fa3"/></dir><file name="Observer.php" hash="b374e815b000f34b77baf16bacccf9fc"/><file name="Paymentmethod.php" hash="fb54e7fd83236aaa7824a773b94afe74"/><file name="Status.php" hash="4fdeede680b4420331aae6fda74d36d9"/><file name="Store.php" hash="7b829fe08727d0d7ac2c59abcd34c4b2"/><file name="Validationcrontime.php" hash="525b215224b7e42c945c2b53d3b00c20"/><file name="Validationpaymentmap.php" hash="34eca47cafbe547e9cbb019f61e3de83"/><file name="Validationtaxclass.php" hash="52ef2ddc4cc6e1a7c146c664e2b88ed3"/><file name="Validationtaxcode.php" hash="42f2fc5dcecfb65ce3a56ed167f41266"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="Bluefish_API.php" hash="c07d056ffe4561dc211cc4a946807770"/><file name="Bluefish_Error_Reporting.php" hash="ae152b9b57c4dfee907a4e7f2b7fec1f"/><file name="BluestorecronController.php" hash="371f55c62d4d19151ee11211e82e85c2"/><file name="BluestoreschedulerController.php" hash="198366aa10c1f2bea714a587dc0fb10a"/><file name="CategorydataController.php" hash="7dc83d091cba0bf402f0d8d5c349859f"/><file name="ErrorsaleimportController.php" hash="17a0b262ac68095083ba6180b5c85a1b"/><file name="MyformController.php" hash="a280cc7f57f8e1a1683b1beb815d038f"/><file name="MyformexportController.php" hash="cc856e317b89f29fc35cc789918ceebe"/><file name="ProductdataController.php" hash="9bdedff5d6650a71aafa0cd4195cc002"/><file name="Xml.php" hash="e235cdd526e005e4f4f9e7fa0eade89d"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="f958df2fe25675db0cfa466a13d21317"/><file name="config.xml" hash="9abec081e2091801aa3e0c15fadbb57e"/><file name="system.xml" hash="ff36332cfbb1748a943affbab6db5f65"/></dir><dir name="sql"><dir name="connection_setup"><file name="mysql4-install-0.1.0.php" hash="6badacdb48b9a868da95e2c1761732c4"/><file name="mysql4-upgrade-0.1.0-1.1.1.php" hash="f4d1a592ab45d034f6b40c3712accb63"/><file name="mysql4-upgrade-1.1.1-1.1.2.php" hash="e32a7745adad592cd3fb9a64257d1359"/><file name="mysql4-upgrade-1.1.2-1.1.3.php" hash="a418dfa877ade09191aa57a6a7178933"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="connection"><file name="array_dropdown.phtml" hash="a7570dbb97b61c7f55d40bca280043b8"/><file name="cronschedule.phtml" hash="c503011206bc0b7ca2b7e6fe2fef401c"/><file name="custom_product_radioinput.phtml" hash="50acd5bf82b7926e56f91246cbefb3cf"/><file name="custom_radioinput.phtml" hash="203c94df69e858acdc776d4b10fa812c"/><file name="myform.phtml" hash="016a79f18b4483c697bfbe57ee27e5ee"/><file name="myformexport.phtml" hash="b377f1ac593f43f7b160b7ade7c472da"/><file name="outofstocksale.phtml" hash="e3c1641d1ff1362f3f1845bdd161f3bf"/><file name="salesmapping_radioinput.phtml" hash="e3c1641d1ff1362f3f1845bdd161f3bf"/></dir></dir><dir name="layout"><file name="connection.xml" hash="ae5bb64dd8522cda5c87a075dcdf070c"/></dir></dir></dir></dir></target></contents>
|
| 25 |
<compatible/>
|
| 26 |
<dependencies><required><php><min>5.1.0</min><max>5.6.0</max></php></required></dependencies>
|
| 27 |
</package>
|
