- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
升级后我一直在为客户端重新实现这个脚本,但我被卡住了(也许大脑被炸了)。其中大部分与您无关。我遇到问题的部分在这里:
try
{
$customer_exists = $client->call($sess_id, 'sales_order.info', $ShippedOrderId);
}
catch (exception $e)
{
echo 'Exception: ' . $e . "<br/>";
}
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
var_dump(extension_loaded('ssh2'));
// URL to Magento SOAP API
$client = new SoapClient('http://animalnecessity.com/api/soap?wsdl');
$apiuser = '';
$apikey = '';
// FTP info
$ftp_server = 'ftp.3plworldwide.com';
$ftp_user_name = '';
$ftp_user_pass = '';
// Address to mail report to
$mail_to = '';
$mail_content = "Checking for 3PL shipping import files on " . date('m/d/Y') . "\n\n";
/*** Begin FTP ***/
// Set up SFTP connection
$conn_id = ssh2_connect($ftp_server, 22);
$login_result = ssh2_auth_password($conn_id, $ftp_user_name, $ftp_user_pass);
$sftp = ssh2_sftp($conn_id);
// Check connection results
if ((!$conn_id) || (!$login_result)) {
$mail_content .= "SFTP connection has failed.\n";
$mail_content .= "Attempted to connect to $ftp_server under user '$ftp_user_name', password '$ftp_user_pass'.\n\n";
} else {
$mail_content .= "Successfully connected to $ftp_server with an SFTP secure connection, under user '$ftp_user_name', password '$ftp_user_pass'.\n\n";
}
// Download the files in the SHIPMENTS folder
$download = true;
$dirHandle = opendir("ssh2.sftp://$sftp/SHIPMENTS/");
if ($dirHandle)
{
$filelist = '';
$downarray = array();
while (false !== ($file = readdir($dirHandle)))
{
if (strpos($file, 'OCU_SHP_') !== false)
{
// Choose only shipment files up to 7 days back
$datetag = substr($file, 8, 6);
$year = substr($datetag, 0, 2);
$month = substr($datetag, 2, 2);
$day = substr($datetag, 4, 2);
if (!is_numeric($year)) { continue; }
$datestamp = mktime(0, 0, 0, $month, $day, $year);
if ($datestamp > strtotime('-7 days'))
{
$fileName = 'SHIPMENTS/' . $file;
// Remote stream
if (!$remoteStream = @fopen("ssh2.sftp://$sftp/$fileName", 'r'))
{
$mail_content .= "Unable to open remote file: $fileName\n";
$download = false;
}
// Local stream
if (!$localStream = @fopen("./$fileName", 'w'))
{
$mail_content .= "Unable to open local file for writing: ./$fileName\n";
$download = false;
}
// Write from our remote stream to our local stream
$read = 0;
$fileSize = filesize("ssh2.sftp://$sftp/$fileName");
while ($read < $fileSize && ($buffer = fread($remoteStream, $fileSize - $read)))
{
// Increase our bytes read
$read += strlen($buffer);
// Write to our local file
if (fwrite($localStream, $buffer) === FALSE)
{
$mail_content .= "Unable to write to local file: /localdir/$fileName\n";
$download = false;
}
}
// Close our streams
fclose($localStream);
fclose($remoteStream);
// Update file lists for mail content and imports
$filelist .= $file . "\n";
array_push($downarray, './SHIPMENTS/' . $file);
}
}
}
}
// check download status
if (!$download) {
$mail_content .= "Some file download(s) failed.\n\n";
}
else
{
$mail_content .= "Successfully downloaded all of the following files from $ftp_server:\n\n";
$mail_content .= $filelist . "\n";
}
/*** End FTP ***/
/*** Begin Import ***/
// Read data from downloaded files into array
$lines = array();
foreach ($downarray as $file)
{
$linesnew = file($file);
$lines = array_merge($lines, $linesnew);
}
var_dump($lines);
// Connect to Magento Web Services API
$sess_id = $client->login($apiuser, $apikey);
$mail_content .= "Importing the following shipments:\n\n===\n\n";
$dupecount = 0;
$importcount = 0;
$result = $client->call($sess_id, 'sales_order.list');
echo ($result[1]["order_id"]);
//var_dump($result);
foreach ($lines as $line)
{
set_time_limit(60);
$fields = explode("\t", $line);
$ShippedOrderId = $fields[0];
echo $ShippedOrderId . "<br/>";
if (strlen($ShippedOrderId) == 4) { $ShippedOrderId = '10000' . $ShippedOrderId; }
if (is_numeric($ShippedOrderId))
{
// Check if customer exists
$customer_exists = null;
try
{
$customer_exists = $client->call($sess_id, 'sales_order.info', $ShippedOrderId);
}
catch (exception $e)
{
echo 'Exception: ' . $e . "<br/>";
}
if (($customer_exists != null) && ($customer_exists != ''))
{
echo 'In with ' . $ShippedOrderId . "<br/>";
$order_info = $client->call($sess_id, 'sales_order.info', $ShippedOrderId);
?><pre><?php print_r($order_info); ?></pre><?php
// Skip order if already completed or shipped
if (($order_info['status'] != 'processing') && ($order_info['status'] != 'pending'))
{
$dupecount++;
continue;
}
$comment = '<b><br>*** Order has shipped. ***</b><br/><br/>' .
'<b>3PL order number:</b> ' . $fields[1] . '<br/>' .
'<b>Weight:</b> ' . $fields[2] . '<br/>' .
'<b>Shipped via:</b> ' . $fields[3] . '<br/>' .
'<b>Tracking number:</b> ' . $fields[4] . '<br/>' .
'<b>Ship date:</b> ' . $fields[5] . '<br/>' .
'<b>Postage:</b> ' . $fields[6] . '<br/>' .
'<b>Fulfillment:</b> ' . $fields[7] . '<br/>' .
'<b>Per packslip:</b> ' . $fields[8];
// Make shipment and add tracking number
if ($fields[3] == 'UPS-RESIDENTIAL') { $shippedby = 'ups'; $shipname = 'UPS Ground'; }
elseif ($fields[3] == 'UPS-2') { $shippedby = 'ups'; $shipname = 'UPS 2nd Day Air'; }
elseif ($fields[3] == 'UPS-OVERNIGHT') { $shippedby = 'ups'; $shipname = 'UPS Next Day Air Saver'; }
elseif ($fields[3] == 'USPS-PRI') { $shippedby = 'usps'; $shipname = 'USPS Priority'; }
elseif ($fields[3] == 'CANADA') { $shippedby = 'custom'; $shipname = 'MSI Canada (Standard) '; }
elseif ($fields[3] == 'MSITRACK') { $shippedby = 'custom'; $shipname = 'MSI Canada (Express)'; }
else { $shippedby = 'custom'; }
// Attempt to create the order, notify on failure
try { $newShipmentId = $client->call($sess_id, 'sales_order_shipment.create', array($ShippedOrderId, array(), $comment, true, false, $shippedby, $shipname, $fields[4])); }
catch (Exception $e) { echo 'Shipment creation failed on order '. $ShippedOrderId . ': ', $e->getMessage(); }
// Add comment to order with all the info
$client->call($sess_id, 'sales_order.addComment', array($ShippedOrderId, 'complete', $comment, false));
$mail_content .= $line . "\n";
$importcount++;
}
}
}
$mail_content .= "\n===\n\n";
$mail_content .= $dupecount . " shipments already in cart.\n\n" . $importcount . " new shipments imported on " . date('m/d/Y') . " at " . date('g:ia', strtotime('+1 hour')) . " EST.\n\n";
// Close API session
$client->endSession($sess_id);
mail($mail_to, 'Magento Shipping Import for ' . date('m/d/Y'), $mail_content);
mail($mail_to2, 'Magento Shipping Import for ' . date('m/d/Y'), $mail_content);
mail($mail_to3, 'Magento Shipping Import for ' . date('m/d/Y'), $mail_content);
mail($mail_to4, 'Magento Shipping Import for ' . date('m/d/Y'), $mail_content);
//mail($mail_to5, 'Magento Shipping Import for ' . date('m/d/Y'), $mail_content);
?>
<pre><?php echo $mail_content; ?></pre>
最佳答案
这就是你的电话 (/app/code/core/Mage/Sales/Model/Order/Api.php):
public function info($orderIncrementId)
$ShippedOrderId = $order->getIncrementId();
关于api - Magento 导出订单到 3PL SOAP api 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14349504/
我尝试编写一个有多个链接表的解决方案。现在我有另一个问题: 我想将返回的行数限制为 1000。但我想显示 ID 1-1000,下一页 1001-2000。ID可以以不规则的顺序存储在数据库中(ID 1
我已经尝试申请 Drupal 商业优惠券大约 2 天了。我已经负责验证优惠券,但目前在尝试兑换优惠券时遇到了困难。 所以在我的回调函数中,我正在调用: my_module_coupons_coupon
[问]请帮忙,比如有一个数据 tbl_user | Id | name | | 1 | Bayu | | 2 | Indra | | 3 | Rangga | tbl_data | Id | user
我在 Android 应用程序中使用的一些 Parcelable 自定义类遇到了问题,我设法以一种非常奇怪的方式解决了这个问题。 仅在少数特定情况下,我在读取 parcelable 时发生了崩溃(这让
我一直在做一个项目,我需要在数据库中存储订单列表(在本例中为食品)。 我曾尝试四处寻找存储此类列表的最佳方式,但找不到任何方法。 目前,我将数据存储在 phpMyAdmin/SQL 中,订单存储为要打
目录 1、背景简介 2、订单业务 1、订单体系 2、流程管理 2
HBase案例:客户/订单 假设HBase 用于存储客户和订单信息。有两种核心记录类型被摄取:客户记录类型和订单记录类型。 客户记录类型将包含您通常期望的所有内容: 客户编号 客户名称
C-x C-b 显示缓冲区列表。首先是自然顺序,最近使用的缓冲区在顶部,隐藏的缓冲区在底部。 在那里,我现在可以按名称、大小、模式和文件对缓冲区进行排序。但是一旦我点击了这样的选项,我就无法回到原来的
我为 Woocommerce 添加了一个新的排序选项,它将按最低价格排序。我所有的价格都存储在一个自定义属性中,连同一些其他序列化数据。我想要的是有一个回调函数来反序列化这些数据,检查最低价格并按该价
想象一下我有一张 table : ID field1 field2 --- ------- ------ 111 1 11113 112
Kotlin forEach 是按数组的实际顺序遍历数组还是有时可能按其他顺序遍历数组?我的意思是这是否总是打印 1,2,3,...9 或者它可能会打印类似 1,5,3,4,... val numbe
我在 woocommerce 3+ 上创建了 html 电子邮件模板,但我无法通过订单 ID 获取订单项。我试过这个,但对我不起作用。 get_items(); foreach
我对将我自己的内部广告与 AdMob 的广告一起展示并使用按重要性顺序设置 eCPM 值的问题感到有些困惑。 我目前只与 AdMobs 的网络一起转换一个自家广告。 从常见问题解答和 AdMob 帮助
我正在尝试构建一个电子商务数据库,但我不了解订单,产品和客户之间的关系。 有很多数据库示例,但是它们太复杂了。是否有关于可能的表和关系的更简单的解释或示例。 谢谢。 最佳答案 如果客户可以拥有多个订单
我必须对电子商务系统进行一些更改以添加一些附加信息,并希望借此机会进行一些改进并使其更加灵活。当客户下订单时,我们必须为每个订购的商品存储几项信息;例如,产品价格、运费、征收的税款、所做的任何调整。
我正在尝试新的 ASP.NET bundle 功能,但似乎无法让我的自定义排序正常工作。这是我的 JS 文件: bootstrap.js bootstrap.min.js jquery-1.7.2.i
我正在尝试以下代码,并希望获取日期之间的所有订单并打印它们 $orders = $my_query->posts; $order = wc_get_order( $order_id ); $or
我有 ORMLite 数据库对象,它有一个字段: @ForeignCollectionField(eager = true) public ForeignCollection blocks; 现在,当
除了调用 event_list_attendees 并寻呼与会者以尝试找到正确的用户匹配之外,是否有其他方法可以获取门票/订单的用户条形码 ID?这种方法会增加 eventbrite 服务器的负担,并
这个问题已经有答案了: What is a NullPointerException, and how do I fix it? (12 个回答) 已关闭 5 年前。 我制作了订单食品应用程序。当我单
我是一名优秀的程序员,十分优秀!