Magento 创建一个Credit Memo

1.在magento后台创建一个creditmemo的时候,在数据表里面生成了相应的数据表记录

查询相关表记录

SELECT * FROM  sales_flat_creditmemo ORDER BY  entity_id  DESC  LIMIT 5  ;
SELECT * FROM  sales_flat_creditmemo_item ORDER BY  entity_id  DESC  LIMIT 5  ;
SELECT * FROM  sales_flat_creditmemo_comment ORDER BY  entity_id  DESC  LIMIT 5 ; 
SELECT * FROM  sales_flat_creditmemo_grid ORDER BY  entity_id  DESC  LIMIT 5 ;

sales_flat_creditmemo 表中生成一条记录

sales_flat_creditmemo_item 表根据退货商品种数,生成条数据。

退货了三个品种的商品

sales_flat_creditmemo_grid 表展示网格数据

2. 分别取出相应的表数据信息如下:

$creditMemo  = Mage::getResourceModel('sales/order_creditmemo_collection')
             ->getLastItem()
             ->getData();
         echo "<pre>";
         print_r($creditMemo);
         echo "</pre>";

         $creditMemo  = Mage::getResourceModel('sales/order_creditmemo_item_collection')
             ->getLastItem()
             ->getData();
         echo "<pre>";
         print_r($creditMemo);
         echo "</pre>";


         $creditMemo  = Mage::getResourceModel('sales/order_creditmemo_grid_collection')
             ->getLastItem()
             ->getData();
         echo "<pre>";
         print_r($creditMemo);
         echo "</pre>";

3. 查询出的结果如下:

Array
(
    [entity_id] => 1411
    [store_id] => 1
    [adjustment_positive] => 0.0000
    [base_shipping_tax_amount] => 0.0000
    [store_to_order_rate] => 1.0000
    [base_discount_amount] => -0.0100
    [base_to_order_rate] => 1.0000
    [grand_total] => 338.6400
    [base_adjustment_negative] => 0.0000
    [base_subtotal_incl_tax] => 338.6500
    [shipping_amount] => 0.0000
    [subtotal_incl_tax] => 338.6500
    [adjustment_negative] => 0.0000
    [base_shipping_amount] => 0.0000
    [store_to_base_rate] => 1.0000
    [base_to_global_rate] => 1.0000
    [base_adjustment] => 0.0000
    [base_subtotal] => 338.6500
    [discount_amount] => -0.0100
    [subtotal] => 338.6500
    [adjustment] => 0.0000
    [base_grand_total] => 338.6400
    [base_adjustment_positive] => 0.0000
    [base_tax_amount] => 0.0000
    [shipping_tax_amount] => 0.0000
    [tax_amount] => 0.0000
    [order_id] => 8227
    [email_sent] => 
    [creditmemo_status] => 
    [state] => 2
    [shipping_address_id] => 16454
    [billing_address_id] => 16453
    [invoice_id] => 
    [store_currency_code] => USD
    [order_currency_code] => USD
    [base_currency_code] => USD
    [global_currency_code] => USD
    [transaction_id] => 
    [increment_id] => 100001411
    [created_at] => 2019-05-07 08:00:10
    [updated_at] => 2019-05-07 08:00:10
    [hidden_tax_amount] => 0.0000
    [base_hidden_tax_amount] => 0.0000
    [shipping_hidden_tax_amount] => 
    [base_shipping_hidden_tax_amnt] => 
    [shipping_incl_tax] => 0.0000
    [base_shipping_incl_tax] => 0.0000
    [discount_description] => shipfree199
    [base_amstcred_amount] => 
    [amstcred_amount] => 
    [base_am_amount_total_refunded] => 338.6400
    [am_amount_total_refunded] => 338.6400
    [cybersource_token] => 
)
Array
(
    [entity_id] => 1816
    [parent_id] => 1411
    [base_price] => 1.6500
    [tax_amount] => 0.0000
    [base_row_total] => 1.6500
    [discount_amount] => 
    [row_total] => 1.6500
    [base_discount_amount] => 
    [price_incl_tax] => 1.6500
    [base_tax_amount] => 0.0000
    [base_price_incl_tax] => 1.6500
    [qty] => 1.0000
    [base_cost] => 0.5600
    [price] => 1.6500
    [base_row_total_incl_tax] => 1.6500
    [row_total_incl_tax] => 1.6500
    [product_id] => 350
    [order_item_id] => 21391
    [additional_data] => 
    [description] => 
    [sku] => U1015
    [name] => Lollicup Scoop (1oz), U1015
    [hidden_tax_amount] => 0.0000
    [base_hidden_tax_amount] => 0.0000
    [weee_tax_disposition] => 0.0000
    [weee_tax_row_disposition] => 0.0000
    [base_weee_tax_disposition] => 0.0000
    [base_weee_tax_row_disposition] => 0.0000
    [weee_tax_applied] => a:0:{}
    [base_weee_tax_applied_amount] => 0.0000
    [base_weee_tax_applied_row_amnt] => 0.0000
    [base_weee_tax_applied_row_amount] => 0.0000
    [weee_tax_applied_amount] => 0.0000
    [weee_tax_applied_row_amount] => 0.0000
)
Array
(
    [entity_id] => 1411
    [store_id] => 1
    [store_to_order_rate] => 1.0000
    [base_to_order_rate] => 1.0000
    [grand_total] => 338.6400
    [store_to_base_rate] => 1.0000
    [base_to_global_rate] => 1.0000
    [base_grand_total] => 338.6400
    [order_id] => 8227
    [creditmemo_status] => 
    [state] => 2
    [invoice_id] => 
    [store_currency_code] => USD
    [order_currency_code] => USD
    [base_currency_code] => USD
    [global_currency_code] => USD
    [increment_id] => 100001411
    [order_increment_id] => 100008291
    [created_at] => 2019-05-07 08:00:10
    [order_created_at] => 2018-11-20 23:48:46
    [billing_name] => qisong  lin
)

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用 * 标注