<?php 
	require(__DIR__.'/connect.php'); break; // listo
	$db = new connect('visionwe_mateckoriginal','visionwe_matecku','7Z}jf_6}{KZ]');
	$mateck = new connect('visionwe_mateckkdb','visionwe_matecku','7Z}jf_6}{KZ]');

	$query ="
	SELECT 
		p.products_id,
		p.products_ean,
		p.products_quantity,
		p.products_model,
		p.products_image,
		p.products_price,
		p.products_date_added,
		p.products_last_modified,
		p.products_weight
			FROM 
				products p 
			WHERE 
				1
			
			ORDER BY p.products_id ASC 
		";
	$productos = $db->getRows($query); 
	$cont = 1;
	echo "Comensando registro de productos...<br/>";
	foreach($productos as $producto):
		$cont++;
		$idProducto = $producto['products_id'];
		$sql="
			insert 
				into ax_product(
					id_product, 
					id_category_default, 
					id_shop_default, 
					ean13,
					reference,
					quantity, 
					minimal_quantity, 
					price, 
					out_of_stock, 
					available_date, 
					`condition`, 
					show_price, 
					visibility, 
					date_add, 
					date_upd, 
					pack_stock_type, 
					active
				)";
		$sql.='values("'.$producto['products_id'].'","2","1","'.$producto['products_ean'].'","'.$producto['products_model'].'","'.$producto['products_quantity'].'","1","';
		$sql.=$producto['products_price'].'","2","'.date('Y-m-d').'","new","1","both","'.$producto['products_date_added'].'","'.$producto['products_last_modified'].'","3","1")';
		$mateck->insertRow($sql);
		$sql="
			insert 
				into ax_product_shop(
					id_product, 
					id_shop, 
					id_category_default,
					minimal_quantity, 
					price, 
					available_for_order,
					available_date, 
					`condition`, 
					show_price, 
					visibility, 
					date_add, 
					date_upd, 
					pack_stock_type,
					active
				)";
		$sql.='values("'.$producto['products_id'].'","1","2","1","'.$producto['products_price'].'","1","'.date('Y-m-d').'","new","1","both","'.$producto['products_date_added'].'","'.$producto['products_last_modified'].'","3","1")';
		$mateck->insertRow($sql);
		echo "Producto registrado ($idProducto).. Oks...<br/>";
		
	endforeach;
	echo "Fin de la consulta";
	
	