Page 1 of 2

adding model number to order list [solved]

Posted: Fri Mar 02, 2012 4:39 am
by labeshops
Okay, can someone explain this to me in english, cuz I've been going nuts trying to figure out how to add things to a template and finally decided to yell...HELP!!

I understand the CMV model but cannot make sense out of the coding. My former cart used 1file and a template and queries not all the $This stuff. So I thought I was trying to something simple to get my head around it, but a week later, I have a major headache.

What I started with was editing order_list.tpl which I figured out uses controller/order.php and model/order.php. I decided to remove the total and date added columns I really didn't need. Got that done no, problem.

Then I wanted to add a column for products that would pull in a list of all the model numbers that were ordered on each order to make it easy for myself to figure out who gets what when I get in a shipment.

Looking at the controller file, it looks like model is already defined, so in order_list.tpl, I added <td class="left"><?php echo $order['model']; ?></td> where I wanted it to be and nothing.

So I looked at the controller file and found the section starting... " private function getList() {" which I think generates the list the order_list.tpl shows.

I found an array in that section that looks like is what pulls the list for the tables:

Code: Select all

			$this->data['orders'][] = array(
				'order_id'      => $result['order_id'],
				'customer'      => $result['customer'],
				'status'        => $result['status'],
				'total'         => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
				'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
				'selected'      => isset($this->request->post['selected']) && in_array($result['order_id'], $this->request->post['selected']),
				'action'        => $action
			);
So I tried adding the model field to the array:

Code: Select all

			$this->data['orders'][] = array(
				'order_id'      => $result['order_id'],
				'customer'      => $result['customer'],
				'status'        => $result['status'],
				'model'         => $result['model'],
				'total'         => $this->currency->format($result['total'], $result['currency_code'], $result['currency_value']),
				'date_added'    => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
				'date_modified' => date($this->language->get('date_format_short'), strtotime($result['date_modified'])),
				'selected'      => isset($this->request->post['selected']) && in_array($result['order_id'], $this->request->post['selected']),
				'action'        => $action
			);
But still no go. So now I'm at a loss :(

adding something to order list

Posted: Fri Mar 02, 2012 5:46 am
by uksitebuilder
Hi Lori

The problem you have is the controller data you are accessing is only grabbing data from the model concerning the order (let's call it header) i.e. the totals

What you want to do is grab the product data from each order

I am AFK ATM but in the morning after I've had my 3CC I'll post a solution for you

Re: adding something to order list

Posted: Fri Mar 02, 2012 11:04 pm
by labeshops
Hmmm.... The section I added the model tag to was in " <?php foreach ($orders as $order) { ?>" so I thought it would grab all the tags. *sigh*

Just having problems getting my head around the way OC is coded versus my former cart (cubecart). I thought little things like this would be easy since I did so many things like it in cubecart, but it gives me headaches :P I'm sure eventually I'll get the hang of it - took me time before too.

If you weren't all the way in the UK, I'd buy ya a coffee :) Thanks in advance.

Re: adding something to order list

Posted: Tue Mar 27, 2012 12:39 am
by labeshops
Hi Simon

Still not having any luck doing this :P I have the column set up for it but nothing seems to put the model numbers from each order into the column? :P

Re: adding model something to order list

Posted: Fri Apr 20, 2012 9:38 pm
by labeshops
I'm still trying to figure this one out. Now that my biggest stores are switched over to OC I really, really need to figure it out. Just cannot seem to make it work.

Anyone have ideas???

Re: adding model number to order list

Posted: Tue Jul 03, 2012 2:42 am
by labeshops
Still trying to figure this out - last backend thing I need to do. No one has a suggestion????

Re: adding model number to order list

Posted: Thu Aug 16, 2012 3:28 am
by labeshops
bumping 1 more time as I really, really need this to make opencart work 100% for me.

Re: adding model number to order list

Posted: Mon Aug 20, 2012 10:12 pm
by Strangeman
Frustrating - I was hoping to see the answer to that question myself ....

Re: adding model number to order list

Posted: Mon Aug 20, 2012 10:19 pm
by labeshops
Yeah, it's still driving me nuts. Should be simple - I had it set up on my old software in like an hour - but cannot for the life of me get it to work in opencart :P And having to open every order to see if it's something I have in stock or if I need to dropship, order it, whatever takes quit a bit of time when a quick glance would do it :P

Re: adding model number to order list

Posted: Mon Aug 20, 2012 11:33 pm
by pprmkr
It's not that difficult:

In de controller order.php in the private function getList() starting at line 329 add:

Code: Select all

		$this->load->model('catalog/product');	
		$orderlist_product_models = '| ';		
		$orderlist_products = $this->model_sale_order->getOrderProducts($result['order_id']);
		foreach ($orderlist_products as $orderlist_product) {
			$orderlist_product_models .= $orderlist_product['model'] . ' | ';
		}
Then at line 342 add:

Code: Select all

				'models'		=> $orderlist_product_models,
In the template order_list.tpl starting at line 45 add:

Code: Select all

			  <td>Modelnumbers in order</td>
Then at line 80 add:

Code: Select all

              <td></td>
And at line 97 add:

Code: Select all

              <td class="center"><?php echo $order['models']; ?></td>

Re: adding model number to order list

Posted: Tue Aug 21, 2012 2:24 am
by labeshops
pprmkr, you are my hero of the week! Thank you! Works perfectly and my orders system is now complete! :) You rock!

Re: adding model number to order list [solved]

Posted: Thu Dec 20, 2012 5:07 am
by watchitnow
Hi pprmkr,

I was also searching for this. But I wanted to show the shipping costs (the price of the shipment).

First I tried it with the model, I got this to work. Then I modifiet you lines, but I can't get it to work. Could you please tell me what I should do?

Greatings,
Twan Keizer
www.watchitnow.nl

Re: adding model number to order list [solved]

Posted: Thu Dec 20, 2012 7:23 pm
by pprmkr
Hi Twan Keizer.

See attached vQmod for the required modifications.

If vQmod installed, copy the file to /vqmod/xml

Hope you appreciate the help.

Re: adding model number to order list [solved]

Posted: Sun Dec 23, 2012 1:09 am
by watchitnow
Hi pprmkr,

Thank you very much, that is just what I needed. And I thing others can also appreciate is, because it is already downloaded 3 times!

I donated al small amount;)

Greatings,
Twan Keizer
www.watchitnow.nl

Re: adding model number to order list [solved]

Posted: Sun Dec 23, 2012 1:40 am
by pprmkr
Hi Twan,

Thank you very much!

Regards,
Roelie @ PprMkr

Re: adding model number to order list [solved]

Posted: Tue May 06, 2014 5:21 am
by labeshops
This doesn't work any more for 1.5.6.4 - any idea what I need to change?

Re: adding model number to order list [solved]

Posted: Tue May 06, 2014 5:15 pm
by pprmkr
Add Shippingcosts to orderlist.xml Tested and works on 1.5.6.4

Attached: Add Model to orderlist.xml
Tested on 1.5.6.4 fresh install with vQmod 2.4.1

Re: adding model number to order list [solved]

Posted: Tue May 06, 2014 7:56 pm
by labeshops
Thank you pprmkr! Once again, you rock!

Re: adding model number to order list [solved]

Posted: Mon May 12, 2014 5:13 pm
by DudiCohen
Hey pprmkr,

I need same xml but i want its shows the Manufacturer of the order.

Can you please help me with this?

Thank you!

Re: adding model number to order list [solved]

Posted: Mon May 12, 2014 10:51 pm
by pprmkr
Manufacturer is not stored in order table.

First read product, get manufacturer_id, then get manufacturer name

Image