VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: cliquedm on August 31, 2016, 09:02:27 AM

Title: Copy 'List orders' layout and menu item
Post by: cliquedm on August 31, 2016, 09:02:27 AM
Trying to get a handle on how to do this but coming up against a brick wall.

I need a copy of the 'list orders' menu item for virtuemart so I can edit it and leave original 'list orders' in tact.

From what I read there should be a Model, View and Controller for 'List orders' but there isn't one that I can see.

Can anyone help me please?

EDIT: Joomla 3.6.2 and Virtuemart 3.0.16
Title: Re: Copy 'List orders' layout and menu item
Post by: GJC Web Design on August 31, 2016, 13:34:20 PM
index.php?option=com_virtuemart&view=orders&layout=list

layout refers to  components\com_virtuemart\views\orders\tmpl\list.php

try a list2.php and layout=list2
Title: Re: Copy 'List orders' layout and menu item
Post by: cliquedm on August 31, 2016, 15:47:13 PM
Thanks, I tried that.

Created another list.php and list.xml files called list2.php and list2.xml

then created and external link menu to

index.php?option=com_virtuemart&view=orders&layout=list2

but i get the following error when I go to the menu item 'Order not found! It may have been deleted.'

if I edit the external link menu to

index.php?option=com_virtuemart&view=orders&layout=list

the orders list works, so must be missing something simple!

Thanks
Title: Re: Copy 'List orders' layout and menu item
Post by: GJC Web Design on August 31, 2016, 19:17:11 PM
mine was just a guess.. check that u are landing on list2 -- if not trace back
Title: Re: Copy 'List orders' layout and menu item
Post by: cliquedm on August 31, 2016, 21:02:54 PM
Ok, well thanks for your help.

Was reading up on the MVC framework the follow but this doesn't appear to work that way, so i'm not sure where I should be tracking back!
Title: Re: Copy 'List orders' layout and menu item
Post by: GJC Web Design on August 31, 2016, 23:02:19 PM
In VM the M (models) are all in the admin end..

so in the above the components\com_virtuemart\views\orders\view.html.php loads the admin vm orders model and uses its functions to get the order or order list etc

e.g. $orderModel = VmModel::getModel('orders');


u get not found because of this snippet in view.html

$this->order_list_link = JRoute::_('index.php?option=com_virtuemart&view=orders&layout=list', FALSE);

         $orderDetails = $orderModel ->getMyOrderDetails();

         if(!$orderDetails or empty($orderDetails['details'])){
            echo vmText::_('COM_VIRTUEMART_ORDER_NOTFOUND');
            return;
         }
Title: Re: Copy 'List orders' layout and menu item
Post by: cliquedm on September 01, 2016, 10:06:41 AM
Thanks for your help, really appreciated.

Just wanted to let you know I found the issue, basically it was in the router.php

there wasn't a rewriting case setup for 'list2' so it was redirecting to 'list' and causing the issue

when i added the following text to the router.php around line 508 it worked

else if ($helper->compareKey($segments[0],'list2') ) {
         $vars['layout'] = 'list2';
         array_shift($segments);
      }
Title: Re: Copy 'List orders' layout and menu item
Post by: GJC Web Design on September 01, 2016, 10:46:20 AM
Ah .. sef ...   :)