我对DC很新;尝试从结帐完成选项卡中收集用户ID和SKU数据,以将其上传到S3。看来,只要我收集数据并写入user.txt文件,DC就会与实体元数据异常一起崩溃。非常感谢如何正确地做任何方向。
(将数据上传到S3没问题,它可以从脚本运行,并正确生成user.txt文件。)
<?php
function getproductfile_commerce_checkout_complete($order) {
$s3file = fopen("/var/tmp/user.txt","a");
$ow = entity_metadata_wrapper('commerce_order', $order);
foreach ($ow->commerce_line_items as $line_item) {
$sku = $line_item->commerce_product->sku->value();
$Usr_name = $line_item->order->owner->label();
$usr_name = strtolower($Usr_name);
$txt1 = $sku.$usr_name;
fwrite($s3file, $txt1);
fwrite($s3file, "\n");
}
fclose($s3file);
// UPLOAD FILES TO S3
$out = shell_exec("sudo aws s3 cp /var/tmp/user.txt s3://user_data_bucket_2015");
} ?&GT;
EntityMetadataWrapperException: Unknown data property commerce_product. in EntityStructureWrapper->getPropertyInfo() (line 335 of /var/www/.../profiles/commerce_kickstart/modules/contrib/entity/includes/entity.wrapper.inc).