* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
/* Security */
if (!defined('_PS_VERSION_'))
exit;
class ShipwireOrder extends ShipwireApi
{
protected $_apiType = 'fulfillmentServices';
public function __construct()
{
parent::__construct();
$this->_configVars['SHIPWIRE_ACCOUNT_NAME'] = '';
$this->_xml['header'] = array(
'',// StorAccountName="'.$this->_configVars['SHIPWIRE_ACCOUNT_NAME'].'">',
''.$this->_configVars['SHIPWIRE_API_USER'].'',
''.$this->_configVars['SHIPWIRE_API_PASSWD'].'',
''.$this->_configVars['SHIPWIRE_API_MODE'].'',
'7403',
);
$this->_xml['body'][] = '';
$this->_xml['footer'][] = '';
}
public function addOrder($values, $refresh = false)
{
foreach ($values as &$v)
if (!empty($v) && !is_array($v))
$v = pSQL($v);
if (!$refresh)
$this->_xml['body'] = array(
'',
''.$this->_configVars['SHIPWIRE_WAREHOUSE'].'',
// ''.$values['sameDay'].'',
'',
''.$values['name'].'',
''.$values['address1'].'',
''.$values['address2'].'',
''.$values['city'].'',
''.$values['country'].'',
''.$values['zip'].'',
''.$values['phone'].'',
''.$values['mail'].'',
'',
''.$values['shippingType'].'',
);
else
$this->_xml['body'] = array('');
$i = 0;
foreach ($values['packageList'] as $item)
{
$this->_xml['body'][] = '- ';
$this->_xml['body'][] = '
'.$item['code'].'';
$this->_xml['body'][] = ''.$item['quantity'].'';
$this->_xml['body'][] = ' ';
}
$this->_xml['body'][] = '';
}
}