Skip to main content
added 47 characters in body
Source Link
Anil Sagar
  • 12.2k
  • 2
  • 31
  • 54

Yes, Commerce Module does store product amount of past order... You can retrieve using below details...

To get full details of order

$order = commerce_order_load($order_id);
$view_mode = "administrator";
print entity_view('commerce_order', array($order->order_id => $order), $view_mode, NULL, TRUE);

To be more specific

  $order = commerce_order_load($order_id);
  foreach ($order->commerce_line_items['und'] as $line) {
    $line_item = commerce_line_item_load($line['line_item_id']);
    dpmdrupal_set_message("<pre>" . print_r($line_item,1) . "</pre>");
  }

There is no chance it gets new price instead of old price since it gets tracked in field_data_commerce_unit_price table in database ... All you need to do is divide by 100 if decimal places are 2 in order line item amount...

enter image description here

Yes, Commerce Module does store product amount of past order... You can retrieve using below details...

To get full details of order

$order = commerce_order_load($order_id);
$view_mode = "administrator";
print entity_view('commerce_order', array($order->order_id => $order), $view_mode, NULL, TRUE);

To be more specific

  $order = commerce_order_load($order_id);
  foreach ($order->commerce_line_items['und'] as $line) {
    $line_item = commerce_line_item_load($line['line_item_id']);
    dpm($line_item);
  }

There is no chance it gets new price instead of old price since it gets tracked in field_data_commerce_unit_price table in database ... All you need to do is divide by 100 if decimal places are 2 in order line item amount...

enter image description here

Yes, Commerce Module does store product amount of past order... You can retrieve using below details...

To get full details of order

$order = commerce_order_load($order_id);
$view_mode = "administrator";
print entity_view('commerce_order', array($order->order_id => $order), $view_mode, NULL, TRUE);

To be more specific

  $order = commerce_order_load($order_id);
  foreach ($order->commerce_line_items['und'] as $line) {
    $line_item = commerce_line_item_load($line['line_item_id']);
    drupal_set_message("<pre>" . print_r($line_item,1) . "</pre>");
  }

There is no chance it gets new price instead of old price since it gets tracked in field_data_commerce_unit_price table in database ... All you need to do is divide by 100 if decimal places are 2 in order line item amount...

enter image description here

added 521 characters in body
Source Link
Anil Sagar
  • 12.2k
  • 2
  • 31
  • 54

Yes, Commerce Module does store product amount of past order... You can retrieve using below details...

See below query in views orderTo get full details which fetchesof order line item details provided line item id

SELECT commerce_line_item.line_item_id AS line_item_id, commerce_line_item.type AS commerce_line_item_type, commerce_line_item.line_item_label AS commerce_line_item_line_item_label, commerce_line_item.quantity AS commerce_line_item_quantity, commerce_line_item.line_item_id AS commerce_line_item_line_item_id, 'commerce_line_item' AS field_data_commerce_unit_price_commerce_line_item_entity_typ, 'commerce_line_item'$order AS= field_data_commerce_total_commerce_line_item_entity_typecommerce_order_load($order_id);
FROM$view_mode 
{commerce_line_item}= commerce_line_item"administrator";
WHEREprint (entity_view('commerce_order', array(commerce_line_item.line_item_id = '1'$order->order_id )=> $order)AND(( (commerce_line_item.type IN, $view_mode, ('product'))NULL, ))TRUE)
ORDER BY commerce_line_item_line_item_id ASC;

To get full details of orderbe more specific

  $order = commerce_order_load($order_id);
$view_mode = "administrator";
print entity_view('commerce_order',foreach array($order->order_id>commerce_line_items['und'] =>as $order$line), $view_mode,{
 NULL, TRUE  $line_item = commerce_line_item_load($line['line_item_id']);
    dpm($line_item);
  }

There is no chance it gets new price instead of old price since it gets tracked in field_data_commerce_unit_price table in database ... All you need to do is divide by 100 if decimal places are 2 in order line item amount...

enter image description here

Yes, Commerce Module does store product amount of past order... You can retrieve using below details...

See below query in views order details which fetches order line item details provided line item id

SELECT commerce_line_item.line_item_id AS line_item_id, commerce_line_item.type AS commerce_line_item_type, commerce_line_item.line_item_label AS commerce_line_item_line_item_label, commerce_line_item.quantity AS commerce_line_item_quantity, commerce_line_item.line_item_id AS commerce_line_item_line_item_id, 'commerce_line_item' AS field_data_commerce_unit_price_commerce_line_item_entity_typ, 'commerce_line_item' AS field_data_commerce_total_commerce_line_item_entity_type
FROM 
{commerce_line_item} commerce_line_item
WHERE (( (commerce_line_item.line_item_id = '1' ) )AND(( (commerce_line_item.type IN  ('product')) )))
ORDER BY commerce_line_item_line_item_id ASC

To get full details of order

$order = commerce_order_load($order_id);
$view_mode = "administrator";
print entity_view('commerce_order', array($order->order_id => $order), $view_mode, NULL, TRUE);

Yes, Commerce Module does store product amount of past order... You can retrieve using below details...

To get full details of order

$order = commerce_order_load($order_id);
$view_mode = "administrator";
print entity_view('commerce_order', array($order->order_id => $order), $view_mode, NULL, TRUE);

To be more specific

  $order = commerce_order_load($order_id);
  foreach ($order->commerce_line_items['und'] as $line) {
    $line_item = commerce_line_item_load($line['line_item_id']);
    dpm($line_item);
  }

There is no chance it gets new price instead of old price since it gets tracked in field_data_commerce_unit_price table in database ... All you need to do is divide by 100 if decimal places are 2 in order line item amount...

enter image description here

Source Link
Anil Sagar
  • 12.2k
  • 2
  • 31
  • 54

Yes, Commerce Module does store product amount of past order... You can retrieve using below details...

See below query in views order details which fetches order line item details provided line item id

SELECT commerce_line_item.line_item_id AS line_item_id, commerce_line_item.type AS commerce_line_item_type, commerce_line_item.line_item_label AS commerce_line_item_line_item_label, commerce_line_item.quantity AS commerce_line_item_quantity, commerce_line_item.line_item_id AS commerce_line_item_line_item_id, 'commerce_line_item' AS field_data_commerce_unit_price_commerce_line_item_entity_typ, 'commerce_line_item' AS field_data_commerce_total_commerce_line_item_entity_type
FROM 
{commerce_line_item} commerce_line_item
WHERE (( (commerce_line_item.line_item_id = '1' ) )AND(( (commerce_line_item.type IN  ('product')) )))
ORDER BY commerce_line_item_line_item_id ASC

To get full details of order

$order = commerce_order_load($order_id);
$view_mode = "administrator";
print entity_view('commerce_order', array($order->order_id => $order), $view_mode, NULL, TRUE);