I want to get SKU and Order ID from Magento database and I know how to get them individually. The problem is I need to get SKU for the product that the order id points towards. I can't figure out the relation between sales_order_flat_table and catalogue_product_entity. I think there are other tables in between that I am missing. May be I should use some id in sales_flat_order_table to get product id and then get SQL.
Magento 1.7 – Get SKU and Order ID Through SQL Query
databasemagento-1.7MySQL
Related Solutions
You need to remove this line from email/order/items.phtml
.
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
This will remove the column header.
Then remove this
<td align="left" valign="top" style="font-size:11px; padding:3px 9px; border-bottom:1px dotted #CCCCCC;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>
from
email/order/items/order/default.phtml
.downloadable/email/order/items/order/downloadable.phtml
bundle/email/order/items/order/default.phtml
This will remove the sku. column for each row.
But don't edit the core files. Copy the files to your theme first.
You have a comma spare in your $orderQuery
just before the closing )
:
...
`shipping_address_country_id`,
)
VALUES (:order_id, :order_number, ....
Than one comma needs to be removed:
$orderQuery = "insert into `neonandmore_timeclock`.`nam_orders` (
`order_id` ,
`order_number` ,
`order_type` ,
`customer_id` ,
`sugarcrm_qms_id` ,
`date_created` ,
`date_modified` ,
`order_status` ,
`total_item_count` ,
`order_shipping_price` ,
`order_tax_price` ,
`order_items_price` ,
`order_grand_total_price` ,
`order_shipping_tracking` ,
`order_shipping_ship_date` ,
`order_notes`,
`billing_address_firstname`,
`billing_address_lastname`,
`billing_address_telephone`,
`billing_address_email`,
`billing_address_street`,
`billing_address_city`,
`billing_address_region`,
`billing_address_postcode`,
`billing_address_country_id`,
`shipping_address_firstname`,
`shipping_address_lastname`,
`shipping_address_telephone`,
`shipping_address_email`,
`shipping_address_street`,
`shipping_address_city`,
`shipping_address_region`,
`shipping_address_postcode`,
`shipping_address_country_id`
)
VALUES (:order_id, :order_number, :order_type, :customer_id, :sugarcrm_qms_id, :date_created, :date_modified, :order_status, :total_item_count, :order_shipping_price, :order_tax_price, :order_items_price, :order_grand_total_price, :order_shipping_tracking, :order_shipping_ship_date, :order_notes, :billing_address_firstname, :billing_address_lastname, :billing_address_telephone, :billing_address_email, :billing_address_street, :billing_address_city, :billing_address_region, :billing_address_postcode, :billing_address_country_id, :shipping_address_firstname, :shipping_address_lastname, :shipping_address_telephone, :shipping_address_email, :shipping_address_street, :shipping_address_city, :shipping_address_region, :shipping_address_postcode, :shipping_address_country_id)";
Best Answer
you should use also the following tables and fields in your query: sales_flat_order_item [quote_item_id]
sales_flat_quote_item [product_id]