Jump to content

Edit History

w3bsolutions

w3bsolutions

  On 1/1/2020 at 5:35 PM, behcet said:

 



        foreach ($products as $row) {
					// hack start
			if( end($products) === $row ) { 
			$row['first_order_message'] = nl2br($order->getFirstMessage());
			$CustomerThread_messagelar = CustomerMessage::getMessagesByOrderId($order->id, $private = false); 	// last Customer Message private = false
			$row['CustomerThread_message'] = $CustomerThread_messagelar[0][message];							// last Customer Message	

		}

 

Expand  

You are retrieving the same message inside the products loop... the message should only be retrieved once and outside the loop.

w3bsolutions

w3bsolutions

  On 1/1/2020 at 5:35 PM, behcet said:

 


        foreach ($products as $row) {
					// hack start
			if( end($products) === $row ) { 
			$row['first_order_message'] = nl2br($order->getFirstMessage());
			$CustomerThread_messagelar = CustomerMessage::getMessagesByOrderId($order->id, $private = false); 	// last Customer Message private = false
			$row['CustomerThread_message'] = $CustomerThread_messagelar[0][message];							// last Customer Message	

		}

 

Expand  

You are retrieving the same message over and over for each product... instead of a hack that is rather a performance penalty... the message should only be retrieved once. 

×
×
  • Create New...