Post by labeshops » Fri Mar 02, 2012 4:39 am

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 :(
Last edited by labeshops on Tue Aug 21, 2012 2:25 am, edited 3 times in total.

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by uksitebuilder » Fri Mar 02, 2012 5:46 am

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

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by labeshops » Fri Mar 02, 2012 11:04 pm

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.

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by labeshops » Tue Mar 27, 2012 12:39 am

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

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by labeshops » Fri Apr 20, 2012 9:38 pm

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???

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by labeshops » Tue Jul 03, 2012 2:42 am

Still trying to figure this out - last backend thing I need to do. No one has a suggestion????

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by labeshops » Thu Aug 16, 2012 3:28 am

bumping 1 more time as I really, really need this to make opencart work 100% for me.

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by Strangeman » Mon Aug 20, 2012 10:12 pm

Frustrating - I was hoping to see the answer to that question myself ....

New member

Posts

Joined
Tue May 29, 2012 4:39 am

Post by labeshops » Mon Aug 20, 2012 10:19 pm

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

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by pprmkr » Mon Aug 20, 2012 11:33 pm

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>

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by labeshops » Tue Aug 21, 2012 2:24 am

pprmkr, you are my hero of the week! Thank you! Works perfectly and my orders system is now complete! :) You rock!

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by watchitnow » Thu Dec 20, 2012 5:07 am

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

Newbie

Posts

Joined
Sat May 05, 2012 1:04 am

Post by pprmkr » Thu Dec 20, 2012 7:23 pm

Hi Twan Keizer.

See attached vQmod for the required modifications.

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

Hope you appreciate the help.

Attachments


User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by watchitnow » Sun Dec 23, 2012 1:09 am

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

Newbie

Posts

Joined
Sat May 05, 2012 1:04 am

Post by pprmkr » Sun Dec 23, 2012 1:40 am

Hi Twan,

Thank you very much!

Regards,
Roelie @ PprMkr

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by labeshops » Tue May 06, 2014 5:21 am

This doesn't work any more for 1.5.6.4 - any idea what I need to change?

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by pprmkr » Tue May 06, 2014 5:15 pm

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

Attachments


User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by labeshops » Tue May 06, 2014 7:56 pm

Thank you pprmkr! Once again, you rock!

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by DudiCohen » Mon May 12, 2014 5:13 pm

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!

Newbie

Posts

Joined
Mon May 12, 2014 5:07 pm

Post by pprmkr » Mon May 12, 2014 10:51 pm

Manufacturer is not stored in order table.

First read product, get manufacturer_id, then get manufacturer name

Image

Attachments


User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands
Who is online

Users browsing this forum: No registered users and 18 guests