Jump to content

Product details not showing in Orders 1.5.5


Recommended Posts

Hi guys me again lol,

 

the problem is when a customer places an order the order details show but no product details, when i come to print the invoice everything is there except the product details as well. very confused as i have not changed any of the  admin files.

 

just to let you know the order shows as valid in carts with all product details there.

 

plz help me its driving me mad!

 

post-320607-0-34146900-1384252027_thumb.png

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 3 months later...

Since the following SQL query:

 

SELECT *
FROM `ps_order_detail` od
LEFT JOIN `ps_product` p ON (p.id_product = od.product_id)
LEFT JOIN `ps_product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
WHERE od.`id_order` = X'
is responsible for showing up the list with product details, please check ps_order_detail table for missing records and let us know what you find there.
  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

I am having the exact same problem,,, Can someone please help.. 

Also i feel that this problem started after i tried to install PRESTASMS module,, but i am not sure if this is the reason,

Prestasms was not installed properly and shows as additional tabs in my admin panel,, infact it shows twice,. I am not sure how to delete it though..

 

Kindly suggest a solution

Link to comment
Share on other sites

  • 4 months later...

Is anyone found the solution?

 

If not then i have found the meanwhile solution not technically correct but will work out.

 

Go to admin panel -> Main menu -> Customers-> Shopping carts.

Match the order id (from Orders )with the order id (from shopping carts).

Open that shopping cart record and do the following.

 

You just need to fire query in ps_order_detail. If you have 4 items/products in shopping cart then you may have to fire 4 queries.

Means no of products = no of queries  in ps_order_detail.

You can take ps_cart and ps_cart_product as reference.

After fire query, clear your cache folder. Then load the order list. You have all product data.

 

 

Go to your database found following tables.

1) ps_cart

2) ps_cart_product

3) ps_order_detail

 

Following query will help you out. You can take reference.

INSERT INTO `sample_db`.`ps_order_detail` 
(`id_order_detail`, `id_order`, `id_order_invoice`, `id_warehouse`, `id_shop`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_in_stock`, `product_quantity_refunded`, `product_quantity_return`, `product_quantity_reinjected`, `product_price`, `reduction_percent`, `reduction_amount`, `reduction_amount_tax_incl`, `reduction_amount_tax_excl`, `group_reduction`, `product_quantity_discount`, `product_ean13`, `product_upc`, `product_reference`, `product_supplier_reference`, `product_weight`, `tax_computation_method`, `tax_name`, `tax_rate`, `ecotax`, `ecotax_tax_rate`, `discount_quantity_applied`, `download_hash`, `download_nb`, `download_deadline`, `total_price_tax_incl`, `total_price_tax_excl`, `unit_price_tax_incl`, `unit_price_tax_excl`, `total_shipping_price_tax_incl`, `total_shipping_price_tax_excl`, `purchase_supplier_price`, `original_product_price`) 


VALUES 
(NULL, '1001', '95', '0', '1', '20', NULL, 'Product name-1', '1', '1', '0', '0', '0', '13.950000', '0.00', '0.000000', '0.000000', '0.000000', '0.00', '0.000000', NULL, NULL, 'Ref 7111-9090-15', NULL, '0.000000', '0', '', '0.000', '0.000000', '0.000', '0', NULL, '0', NULL, '13.950000', '13.950000', '13.950000', '13.950000', '0.000000', '0.000000', '0.000000', '13.950000'),


(NULL, '1001', '95', '0', '1', '24', NULL, 'Product name-2', '1', '1', '0', '0', '0', '13.950000', '0.00', '0.000000', '0.000000', '0.000000', '0.00', '0.000000', NULL, NULL, 'Ref 7111-9090-32', NULL, '0.000000', '0', '', '0.000', '0.000000', '0.000', '0', NULL, '0', NULL, '13.950000', '13.950000', '13.950000', '13.950000', '0.000000', '0.000000', '0.000000', '13.950000');

Let us know if you have facing any issues.

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Hi guys me again lol,

 

the problem is when a customer places an order the order details show but no product details, when i come to print the invoice everything is there except the product details as well. very confused as i have not changed any of the  admin files.

 

just to let you know the order shows as valid in carts with all product details there.

 

plz help me its driving me mad!

 

attachicon.gifOrdersPrestaShop™.png

 

 

Hello 

 

can any body help

Please check your table ps_order_detail and find column id_tax_rules_group if not exits then create it type int(11) i hope this  help you

Link to comment
Share on other sites

  • 4 months later...

Hi

Did anyone ever find a fix for this? I am currently using version 1.6.0.9 and are having the exact same problem, at least periodically, maybe one order out of 25 has this error. Tried checking for differences in payment modules, products etc, but it can happen with two identical orders from one day to the other.

 

As archSandy wrote, I have no problems with getting the information from the basket, however ps_order_detail doesn't contain any information for the orders with the error.

Would anyone have any ideas how to debug periodical mistakes like these?

Appreciate your help. 

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
  • 2 weeks later...
  • 1 month later...

Hi there,

 

Same problem here, using Prestashop 1.6.1.0.

Unbelievably frustrating, please, look into it.

 

All orders are saved correctly to DB, to table ps_orders. However matching records from table ps_order_details are missing, not a single row with id of order, which has missing products.

 

Anyone solved this meanwhile, any fix, idea? I do not mind doing clean install.

 

Cheers.

Link to comment
Share on other sites

Might be the case. But the problem is, I am not able to reproduce the error.

 

When I try to buy something using test account, everything is okay, no problem. It just sometimes happens, apparently random (well, I suppose it is not random in fact...). I could do it all day long to finally get the error. Argh, I will try it eventually.

Link to comment
Share on other sites

  • 1 month later...

Since the following SQL query:

 

SELECT *
FROM `ps_order_detail` od
LEFT JOIN `ps_product` p ON (p.id_product = od.product_id)
LEFT JOIN `ps_product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
WHERE od.`id_order` = X'
is responsible for showing up the list with product details, please check ps_order_detail table for missing records and let us know what you find there.

 

if under table id_order_invoice is 0, then i recognised this orders don't have order detail in invoice pdf, delivery pdf and  BO. what shoud i do then?

Link to comment
Share on other sites

  • 2 weeks later...

Yes, Prestashop is like a beautiful young girl, sometimes she smile - sometimes she cry.... sometimes the order are recorded beautifully, sometimes are just blank in product list... whithout any reason.... And it is about 50-50, so i have manually make orders from BO for this emply list.

In good days when i get a lot of orders, then i don't have enough time for this.

Can i life with this problem? up to now, yes. But i am a little bit affraid everytime new order made.

i use 1.6.1.4, standard template with only CSS modification, 5 steps checkout, no guest order, no tax system, payment with Paypal and Bankwire.... and no, i don't know anything about SQL Query so i will never touch my DB.

Link to comment
Share on other sites

@Rosha

Could you give some more information then?

 

As far as I understand it happened right after enabling mail alerts? Have you also configured the module? And what happens if you disable the module? Will new orders show up again in the order list, or not? 

Yes

 

2 days ago there wasn't any problem. After that I installed and enabled "Mail Alert" and "Cash On delivery" and today I realized about this problem this morning when a customer placed an order.

 

I disable Mail Alert and I try again to place an order right now, and there are some error:

 

[PrestaShopDatabaseException]

Unknown column 'original_wholesale_price' in 'field list'

INSERT INTO `ps_order_detail` (`id_order`, `id_order_invoice`, `id_warehouse`, `id_shop`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_in_stock`, `product_quantity_return`, `product_quantity_refunded`, `product_quantity_reinjected`, `product_price`, `reduction_percent`, `reduction_amount`, `reduction_amount_tax_incl`, `reduction_amount_tax_excl`, `group_reduction`, `product_quantity_discount`, `product_ean13`, `product_upc`, `product_reference`, `product_supplier_reference`, `product_weight`, `tax_name`, `tax_rate`, `tax_computation_method`, `id_tax_rules_group`, `ecotax`, `ecotax_tax_rate`, `discount_quantity_applied`, `download_hash`, `download_nb`, `download_deadline`, `unit_price_tax_incl`, `unit_price_tax_excl`, `total_price_tax_incl`, `total_price_tax_excl`, `total_shipping_price_tax_excl`, `total_shipping_price_tax_incl`, `purchase_supplier_price`, `original_product_price`, `original_wholesale_price`) VALUES ('8', '0', '0', '1', '53', '135', 'کتری برقی مسافرتی Stillo - رنگ : آبی', '1', '1', '0', '0', '0', '17000', '0', '0', '0', '0', '0', '0', '', '', '', '', '0', '', '0', '0', '0', '0', '0', '0', '', '0', '0000-00-00 00:00:00', '17000', '17000', '17000', '17000', '0', '0', '0', '17000', '0')

Added:

It solved.

 

Thank you all.

Edited by Rosha (see edit history)
Link to comment
Share on other sites

Awesome! Solved.

 

Could you share what you have done in order to solve the problem? In case anyone else (with the same problem) would read this topic.

For my first problem (not showing orders) I added original_wholesale_price to the database. and it solved.(because the error said "this column is not exist")

For Second problem (Duplicate entry '1-1' for key 'PRIMARY') I cleared all old order record in database and it solved too!

 

and now I want to install "Mailalert" module again, to check if it was the main problem or not.

Edited by Rosha (see edit history)
Link to comment
Share on other sites

Here's what i had done

 

First of all,

-Take a back up of classes folder

 

Then,

1. Get a fresh copy of Prestashop installed on your local server

2. Copy entire folder of "order" from classes folder

3. Replace it with the old one.(Backup first)

4. Done.

 

Thanks

 Neal

Link to comment
Share on other sites

  • 1 year later...

Here is my work around

i created a cron task to run every hour with the command 
http://websitedomain.com/cronMonitor.php?cronRequest=1&action=checkOrders

 

And then added the following script to the root directory cronMonitor.php

 

which will check to find missing products on orders and email me the insert queries for me to review and run on the DB

<?php

	// ini_set('display_errors', 1);
	// ini_set('display_startup_errors', 1);
	// error_reporting(E_ALL);

	define('_DB_SERVER_', 'localhost');
	define('_DB_NAME_', '####');
	define('_DB_USER_', '####');
	define('_DB_PASSWD_', '####');
	//connection to the database
	$dbhandle = mysql_connect(_DB_SERVER_, _DB_USER_, _DB_PASSWD_) 
	 or die("Unable to connect to MySQL");
	

	//select a database to work with
	$selected = mysql_select_db(_DB_NAME_,$dbhandle) 
	  or die("Could not select examples");

	
	if(isset($_GET['cronRequest'])){
		$action = $_GET['action'];

		// $productLangData = mysql_query("SELECT prl.* FROM ps_product_lang prl  WHERE prl.id_product = '4964' and id_lang='1'");

		// 							$productLangDataResult = mysql_fetch_array($productLangData);		

								

		    switch ($action) {
				case 'checkOrders':	

							
						$orderData = mysql_query("SELECT po.*, pod.id_order_detail FROM ps_orders po  LEFT JOIN ps_order_detail pod ON  po.id_order = pod.id_order WHERE pod.id_order IS NULL");


						
						while ($orderRow = mysql_fetch_assoc($orderData)) {

// echo '<pre>';
// 									var_dump($orderRow);
// 									die();

						   // echo "ID:".$row['id_order'];
							$idCart = $orderRow['id_cart'];	
							$cartData = mysql_query("SELECT c.* FROM ps_cart c  WHERE id_cart = '".$idCart."'");

							$cartDataResult = mysql_fetch_array($cartData);					
							$cartDataResultCount = mysql_num_rows($cartData);			

							
							if($cartDataResultCount > 0){
								$cartProductRows = mysql_query("SELECT cpr.* FROM ps_cart_product cpr  WHERE cpr.id_cart = '".$idCart."'");


							

								while ($cartProductRowsData = mysql_fetch_assoc($cartProductRows)) {

									
									$productLangString = '';

									$productData = mysql_query("SELECT pr.* FROM ps_product pr  WHERE pr.id_product = '".$cartProductRowsData['id_product']."'");

									$productDataResult = mysql_fetch_array($productData);	

								

									$productLangData = mysql_query("SELECT prl.* FROM ps_product_lang prl  WHERE prl.id_product = '".$cartProductRowsData['id_product']."' and id_lang='1'");

									$productLangDataResult = mysql_fetch_array($productLangData);	

									$productLangString = $productLangDataResult['name'];	

									// 		echo '<pre>';
									// var_dump($cartProductRowsData);
									// die('daniel');

									if($cartProductRowsData['id_product_attribute'] != 0){
										$attributeData = mysql_query("SELECT prl.* FROM ps_attribute prl  WHERE prl.id_attribute = '".$cartProductRowsData['id_product_attribute']."'");

										$attributeDataResult = mysql_fetch_array($attributeData);	
// id_attribute_group
										$attributeGroupLangData = mysql_query("SELECT prl.* FROM ps_attribute_group_lang prl  WHERE prl.id_attribute_group = '".$attributeDataResult['id_attribute_group']."' and id_lang='1'");

										$attributeGroupLangDataResult = mysql_fetch_array($attributeGroupLangData);
										
										$attributeLangData = mysql_query("SELECT prl.* FROM ps_attribute_lang prl  WHERE prl.id_attribute = '".$cartProductRowsData['id_product_attribute']."' and id_lang='1'");

										$attributeLangDataResult = mysql_fetch_array($attributeLangData);

										$productLangString .= ' - '.$attributeGroupLangDataResult['public_name'].' : '.$attributeLangDataResult['name'];
									}

									$totalPriceInc = ($productDataResult['price'] * 1.1) * $cartProductRowsData['quantity'];
									$totalPriceEx = ($productDataResult['price']) * $cartProductRowsData['quantity'];
									
									$unitPriceInc = $productDataResult['price']*1.1;
									$unitPriceEx = $productDataResult['price'];



									

							$sql1 = 'INSERT INTO `ps_order_detail` 
							( 
							`id_order`, `id_order_invoice`, `id_warehouse`, `id_shop`, `product_id`, `product_attribute_id`, 
							`product_name`, `product_quantity`, `product_quantity_in_stock`, `product_quantity_refunded`, `product_quantity_return`, `product_quantity_reinjected`,
							`product_price`, `reduction_percent`, `reduction_amount`, `reduction_amount_tax_incl`, `reduction_amount_tax_excl`, `group_reduction`,
							`product_quantity_discount`, `product_ean13`, `product_upc`, `product_reference`, `product_supplier_reference`,  `product_weight`, 
							`id_tax_rules_group`, `tax_computation_method`, `tax_name`, `tax_rate`, `ecotax`, `ecotax_tax_rate`,
							`discount_quantity_applied`, `download_hash`, `download_nb`, `download_deadline`, `total_price_tax_incl`, `total_price_tax_excl`,
							`unit_price_tax_incl`, `unit_price_tax_excl`, `total_shipping_price_tax_incl`, `total_shipping_price_tax_excl`, `purchase_supplier_price`, `original_product_price`,
							`original_wholesale_price`) VALUES 
							( "'.$orderRow['id_order'].'", "'.$orderRow['invoice_number'].'", 0, 1, "'.$cartProductRowsData['id_product'].'", "'.$cartProductRowsData['id_product_attribute'].'", 
							"'.$productLangString.'", "'.$cartProductRowsData['quantity'].'", "'.$cartProductRowsData['quantity'].'", 0, 0, 0, 
							'.$productDataResult['price'].', 0.00, 0.000000, 0.000000, 0.000000, 0.00, 
							0.000000, "", "", "'.$productDataResult['reference'].'", "", 0.000000, 
							53, 0, "", 0.000, 0.000000, 0.000, 
							0,"", 0, "0000-00-00 00:00:00", '.$totalPriceInc.', '.$totalPriceEx.', 
							'.$unitPriceInc.', '.$unitPriceEx.', 0.000000, 0.000000, 0.000000, '.$unitPriceEx.', 
							0.000000);
							';


							$unitPriceTax = $unitPriceEx /10;
							$unitPriceTaxTotal = $unitPriceTax * $cartProductRowsData['quantity'];



							$sql2 = 'INSERT INTO `ps_order_detail_tax` (`id_order_detail`, `id_tax`, `unit_amount`, `total_amount`) VALUES (id_order_detail, 53, '.$unitPriceTax.', '.$unitPriceTaxTotal.');';




				    	 	$to = 'daniel@####.com.au';

				    	  
							$subject = 'Order Missing Products - '.$orderRow['id_order'];

							$headers = "From: " . strip_tags('daniel@####.com.au') . "\r\n";
							$headers .= "Reply-To: ". strip_tags('daniel@####.com.au') . "\r\n";
							
							$headers .= "MIME-Version: 1.0\r\n";
							$headers .= "Content-Type: text/html; charset=UTF-8\r\n";

							$message = '
								<h1>CHECK AND RUN SQL</h1>
								<br />

							';
							
							$message .= $sql1;
							
							$message .= '
								<br />
								<h1>USE ID FROM PREVIOUS INSERT AS id_order_detail AND RUN SECOND SQL</h1>
								<br />

							';

							$message .= $sql2;
							
	

							mail($to, $subject, $message, $headers);


								}
							}
						}

				break; 	
			}
	}
	
	mysql_close($dbhandle);

	die();
?>
Edited by dondiago (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...