Post by silencox » Sat Aug 27, 2011 9:24 am

Hello

I start to write some modification for dealing with customer orders and i bumped on this

Code: Select all

      		foreach ($data['order_product'] as $order_product) {	
      			$this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET order_id = '" . (int)$order_id . "', product_id = '" . (int)$return_product['product_id'] . "', name = '" . $this->db->escape($return_product['name']) . "', model = '" . $this->db->escape($return_product['model']) . "', quantity = '" . (int)$return_product['quantity'] . "', manufacturer = '" . (int)$return_product['manufacturer'] . "', return_reason_id = '" . (int)$return_product['return_reason_id'] . "', opened = '" . (int)$return_product['opened'] . "', comment = '" . $this->db->escape($return_product['comment']) . "', return_action_id = '" . (int)$return_product['return_action_id'] . "'");
			}
I must admit that i don't understand this foreach loop in addOrder around line 115 and also same thing around line 130
I don't understand why is used $return_product inside this foreach loop since i didn't find and clue for variable $return_product. :o ???

Is this ok


Regards
Sven

Newbie

Posts

Joined
Thu Sep 16, 2010 4:10 pm

Post by Avvici » Sat Aug 27, 2011 10:44 am

Not sure I understand your question. That foreach loop simply iterates over the array $data['order_product'] and INSERTS the data upon each loop.

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by silencox » Sat Aug 27, 2011 10:39 pm

yes i know that

foreach ($data['order_product'] as $order_product) {

But inside this loop there is a lot $return_product, don't have at any place $order_product

And that is what i seems strange since i didn't find any of $return_product declared in whole of
admin/model/sales/order.php, if i use some logic in foreach loop i think that will be proper to use $order_product variable instead $return_product


Regards
Sven

Newbie

Posts

Joined
Thu Sep 16, 2010 4:10 pm
Who is online

Users browsing this forum: No registered users and 24 guests