- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我希望从我要迁移的 magento 系统中导出所有订单的订单信息。这些是我需要的字段
Order_id, sku, item_quantity, item_price, order_total_amount, Created_at, Billing_address, Billing_city, billing_state, billing_country, billing_zipcode, billing_customer_name, billing_customer_mobile, billing_customer_email, shipping_address, shipping_city, Shipping_state, shipping_zipcode, Shipping_country, shipping_charge, shipping_customer_name, shipping_customer_mobile, order_status
我尝试了一些免费扩展,但它们并没有解决我的问题。
如果你能帮我写一个SQL把数据导出来就好了。
我已经有一个 SQL。你能帮我改进这个以获得我需要的细节吗
SELECT sfo.entity_id, sfo.status, sfo.customer_email, oi.product_id, oi.name,
oi.price, sfo.total_due, billing.firstname, billing.lastname, billing.street,
billing.city, billing.postcode, billing.country_id, billing.telephone, shipping.firstname,
shipping.lastname, shipping.street, shipping.city, shipping.postcode, shipping.country_id,
shipping.telephone, sfo.store_name, sfo.store_currency_code, sfo.created_at
FROM sales_flat_order AS sfo
JOIN sales_flat_order_address AS billing ON billing.parent_id=sfo.entity_id AND billing.address_type='billing'
JOIN sales_flat_order_address AS shipping ON shipping.parent_id=sfo.entity_id AND shipping.address_type='shipping'
JOIN sales_flat_order_item as oi ON oi.order_id=sfo.entity_id
我还需要处理一个订单可以包含多个项目的情况。
最佳答案
最好编写一个脚本,从 magento 调用生成 CSV 或 XML,而不是从数据库生成,因为会有很多由键链接的表。 (将它分类到一个文件需要做很多工作,magento 会在 API 或标准调用中为您完成)
这是我们用于将订单导出到自己的 XML 文件的脚本,将其放入 Magento 文件夹并运行。
您可以更改 XML 节点的语法,或将其重写为 CSV 或其他任何内容:
require_once("../app/Mage.php");
umask(0);
Mage::app("default");
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
Mage::init();
// Set an Admin Session
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
Mage::getSingleton('core/session', array('name' => 'adminhtml'));
$userModel = Mage::getModel('admin/user');
$userModel->setUserId(1);
$session = Mage::getSingleton('admin/session');
$session->setUser($userModel);
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
/* Get orders collection of pending orders, run a query */
$collection = Mage::getModel('sales/order')
->getCollection()
// ->addFieldToFilter('state',Array('eq'=>Mage_Sales_Model_Order::STATE_NEW))
->addAttributeToSelect('*');
$out = '<?xml version="1.0" encoding="windows-1250" ?>
<dat:dataPack id="order001" version="2.0" note="Import Order">';
foreach($collection as $order)
{
if ($billingAddress = $order->getBillingAddress()){
$billingStreet = $billingAddress->getStreet();
}
if ($shippingAddress = $order->getShippingAddress()){
$shippingStreet = $shippingAddress->getStreet();
}
$out .= "<dat:dataPackItem version=\"2.0\">\n";
//$out .= "<dat:dataPackItemversion=\"1.0\">\n";
$out.= "<ord:order>\n";
$out.= "<ord:orderHeader>\n";
$out.= "<ord:orderType>receivedOrder</ord:orderType>\n";
$out.= "<ord:numberOrder>".$order->getIncrementId()."</ord:numberOrder>\n";
$out.= "<ord:date>".date('Y-m-d',strtotime($order->getCreatedAt()))."</ord:date>\n";
$out.= "<ord:dateFrom>".date('Y-m-d',strtotime($order->getCreatedAt()))."</ord:dateFrom>\n";
$out.= "<ord:dateTo>".date('Y-m-d',strtotime($order->getCreatedAt()))."</ord:dateTo>\n";
$out.= "<ord:text>Objednávka z internetového obchodu</ord:text>\n";
$out.= "<ord:partnerIdentity>\n";
$out.= "<typ:address>\n";
$out.= "<typ:company>{$billingAddress->getCompany()}</typ:company>\n";
$out.= "<typ:division></typ:division>\n";
$out.= "<typ:name>{$billingAddress->getName()}</typ:name>\n";
$out.= "<typ:city>{$billingAddress->getCity()}</typ:city>\n";
$out.= "<typ:street>{$billingStreet[0]}</typ:street>\n";
$out.= "<typ:zip>{$billingAddress->getPostcode()}</typ:zip>\n";
$out.= "</typ:address> \n";
$out.="<typ:shipToAddress>\n";
$out.= "<typ:company>{$shippingAddress->getCompany()}</typ:company>\n";
$out.= "<typ:division></typ:division>\n";
$out.= "<typ:name>{$shippingAddress->getName()}</typ:name>\n";
$out.= "<typ:city>{$shippingAddress->getCity()}</typ:city>\n";
$out.= "<typ:street>{$shippingStreet[0]}</typ:street>\n";
$out.= "<typ:zip>{$shippingAddress->getPostcode()}</typ:zip>\n";
$out.= "</typ:shipToAddress>\n";
$out.= "</ord:partnerIdentity>\n";
$out.= "<ord:paymentType> \n";
$out.= "<typ:ids>{$order->getShippingDescription()}</typ:ids>\n";
$out.= "</ord:paymentType>\n";
$out.= "<ord:priceLevel>\n";
$out.= "<typ:ids></typ:ids>\n";
$out.= "</ord:priceLevel>\n";
$out.= "</ord:orderHeader>\n";
$out.= "<ord:orderDetail> \n";
foreach ($order->getAllItems() as $itemId => $item){
// textova polozka
$out.= "<ord:orderItem> \n";
$itemname = $item->getName();
$itemname = str_replace('&', " ", $itemname);
$out.= "<ord:text>{$itemname}</ord:text> \n";
$out.= "<ord:quantity>{$item->getQtyOrdered()}</ord:quantity>\n";
//$out.= "<ord:delivered></ord:delivered>";
$out.= "<ord:rateVAT>high</ord:rateVAT> \n";
$out.= "<ord:homeCurrency> \n";
$out.= "<typ:unitPrice>{$item->getPrice()}</typ:unitPrice>\n";
$out.= "</ord:homeCurrency>\n";
$out.= "<ord:stockItem>\n";
$out.= "<typ:stockItem>\n";
$out.= "<typ:ids>{$item->getSku()}</typ:ids>\n";
$out.= "</typ:stockItem>\n";
$out.= "</ord:stockItem>\n";
$out.= "</ord:orderItem>\n";
}
$out.= "</ord:orderDetail>\n";
$out.= "<ord:orderSummary>\n";
$out.= "<ord:roundingDocument>math2one</ord:roundingDocument>\n";
$out.= "</ord:orderSummary>\n";
$out.= "</ord:order>\n";
$out.= "</dat:dataPackItem>\n\n";
};
$out.= "</dat:dataPack>\n";
header ("Content-Type:text/xml");
header ('char-set: cp1250');
@file_put_contents('./dl/response/'.microtime(true).'.txt', $out);
@file_put_contents('php://output', $out);
关于php - 导出订单详细信息 magento,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19922563/
Magento 主题和 Magento 皮肤有什么区别?它们和 Magento 模块之间有什么关系? 最佳答案 主题是创建视觉体验的布局、模板、区域设置和/或外观文件的任意组合... 主题由以下任意或
我想在 Magento 之外获得购物车 Block。这是我的代码。 getLocale()->getLocaleCode(); //Solution Mage::getSingleto
我是 Magento 新手,使用 CE 1.7.0.2 开发了一个网站。现在可以上线了,但我遇到了页面加载缓慢的问题。 我的网站产品主页、列表和详细信息页面最初需要 10-13 秒的时间来加载页面,但
我在 magento 网站上工作。我有 4 个类别,其中两个使用其他主题(不是我的特定 magento 主题)。我如何配置我的主题以从我的默认主题而不是基本主题中获取丢失的文件。 谢谢 最佳答案 通常
我遇到了我的 magento 项目的要求,因此我需要为特定客户群的购买提供特别折扣。此折扣必须显示在客户帐户中,如果他们属于该特定组,并且当用户要使用该特定折扣时,必须根据该折扣优惠对该商品的价格进行
我在 Magento 主题开发中找到的大量教程建议从使用空白作为制作您自己的自定义主题的指南开始。很多这些文章已经很旧了,截至当前版本(1.7),情况仍然如此吗? 附言- 除了 Magento 的 o
似乎这应该是一个可以找到的问题,但我找不到它。 magento 数据库中存储的类别 NAME 在哪里?我可以看到 catalog_category_entity有 key ID,然后还有其他 EAV
我知道 magento 会根据需要调整原始产品图像的大小并以不同的大小对其进行多次缓存。 这些 chached 图像存储在哪里(路径)? 当您从缓存管理中刷新图像缓存时,它们会被删除吗? 如果我要手动
我在我的 magento 网上商店中使用这个扩展 http://www.manadev.com/seo-layered-navigation-plus (分层导航) 此扩展适用于简单的产品。 但就我而
我在 Magento 的一家商店下拥有某些产品的批发属性。我想设置它,以便这些特定属性仅出现在产品页面上,如果客户已登录并且他们在批发客户组中。 这可能吗? 最佳答案 像这样的事情应该可以工作,尽管我
和有什么区别和 在 Magento 中? 我将创建一个新模块,我必须决定在这两个事件中的哪一个事件中挂起我的观察者。 最佳答案 类别(和所有其他对象)保存在事务中。事件catalog_categor
好吧,这是一个似乎很容易解决的问题,但它让我望而却步...... 我的 Magento Web 上有一些类别,每个类别都有一些产品。我希望它们显示为 4 列计数,但它始终显示为 3 列计数,如下所示:
我已经在我的网站上添加了一些成员(member)跟踪代码。为了使跟踪工作正常进行,我需要向关联公司提供确认付款的网址。 我正在使用Magento,我不确定该版本,但几年内未对其进行更新。我需要知道订单
我们的网站遇到了问题。 系统 > 配置屏幕仅显示菜单、侧面菜单和页脚。当我们点击侧边菜单选项时,屏幕仍然黑屏,相关信息也没有出现。请看 this link .这就是出现的情况。当我们点击任何侧面菜单选
我想只使用一个 csv 文件来翻译前端 Magento 商店。所以我这样做了: 我创建了一个名为 Translator 的自定义模块。在其 config.xml 中,我放置了以下几行: ....
我添加了自定义订单状态选项。 有谁知道我如何通过API将其设置为自定义值? 最佳答案 感谢Diglin为我指出的正确位置。只是为了正确地给出答案: 您可以使用addComment方法来执行此操作,该方
目前,Magento 处理大规模操作的方式存在问题。无论分页如何,它都会返回一些 JS,其中包含当前集合和过滤器的每个 db id。这是为了支持网格标题中的“全选”与“全选可见”选项。当您的记录数量较
如何收集具有此角色的所有角色(系统->权限->角色)和用户? 谢谢。 最佳答案 获得所有角色 $roles = Mage::getModel('admin/roles')->getCol
如果能在我网站的各种应用程序之间进行通用登录,那将是一种巨大的用户体验。现在,我有一个 Magento 店面和一个 IPS 板社区。我正在尝试将它们集成到我的用户的一个通用登录中。 IPS 板提供多种
我正在为 Magento 社区 1.4.2 版中的时尚客户开发一个网站,作为该项目的一部分,我需要一些定制的主页促销块来展示特定产品或产品类别。为此,我想我会编写自己的小部件,并且除了如何处理图像外,
我是一名优秀的程序员,十分优秀!