-1

I migrated my Opencart site to Wordpress but unfortunately couldn't transfer the product cost as there is no cost field in Woocommerce. I later installed woocommerce cost plugin and realised I never transferred the cost from OpenCart. All I am left with is the old OpenCart DB. How can I get the Product cost from the SQL File ? I can do it manually if I know which table has the costs.

Dharman
  • 30,962
  • 25
  • 85
  • 135

2 Answers2

0

in OC database oc_product(if you not changed oc_ prefix) table has product cost. Column with name price there the price without taxes. IN OC no additional cost's of the products. Additional prices (cost) calculating during the purchase and storing to the database tables with name oc_order_product and oc_order_total.

K. B.
  • 1,388
  • 2
  • 13
  • 25
0

Woocommerce have 2 price for product: get_price,get_regular_price ;

OpenCart system have little different discount. Its using tables

  • oc_product - main price
  • oc_product_discount - event price
  • oc_product_special - event price

You can get it by queries:

(SELECT price FROM " . DB_PREFIX . "product_discount pd2 
    WHERE pd2.product_id = p.product_id 
    AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' 
    AND pd2.quantity = '1' 
    AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) 
    AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) 
ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, 

(SELECT price FROM " . DB_PREFIX . "product_special ps 
    WHERE ps.product_id = p.product_id 
    AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' 
    AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) 
    AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) 
ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, 
Alexander Sanik
  • 168
  • 1
  • 8