Jump to content

Archived

This topic is now archived and is closed to further replies.

burt

Hooked Orders Page - choose Active Tab.

Recommended Posts

If you have the Paypal App installed, you most likely also have the new style orders page where the data is spread across a number of Tabs, like so:

 

post-69-0-13166600-1433503658_thumb.jpg

 

By default the first tab is open - in this case, the "summary" which holds the customer data, payment method and so on.

 

But maybe you want a different tab as default?

 

To choose the active tab, count from zero across the Tabs. In the above image:

 

Summary = 0

Products = 1

Status History = 2

Paypal = 3

 

You now need to know that this piece of javascript in admin/orders.php invokes the tabs system:

 

<script>
$(function() {
  $('#orderTabs').tabs();
});
</script>
Let's say that you want the "Products" Tab to be open by default when you are looking at the order.

 

<script>
$(function() {
  $('#orderTabs').tabs({active: 1});
});
</script>
Save the file, Upload it.  When you look at an order, the "products" tab will be open by default.

 

Enjoy.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Opened Tab stabilisation after actions in redirection link

 

 

action.php

    function execute() {


      tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit#section_my_hook_name_content'));
    }

tab.php

<div id="section_my_hook_name_content" style="padding: 10px;">
  {$content}
</div>

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Are there plans to add  hook to the order option butoons? Would be really useful to add buttons that perform actions on the current order (pdf invoice, send email, change status...) with one click and without touching the code.

Share this post


Link to post
Share on other sites

Are there plans to add  hook to the order option butoons? Would be really useful to add buttons that perform actions on the current order (pdf invoice, send email, change status...) with one click and without touching the code.

this code could be help as a tab script but i have tested only on my different core

<script>
$(function() {
  $('#contentText > div:first').append('{$my_button}');
});
</script>

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

@@Gergely your code selects the first div on the page, right?

It woud be nice if that div has an id and buttons were on a list to directly select items the same way it's done for the tabs (and same for buttons on the edit order part).

Share this post


Link to post
Share on other sites

@@piernas This example comes from PayPal App mod. No v2.4 final admin found at this moment.

I dont think that we need buttons in header if tabs give more solutions with previews and so on.

 

I dont use buttons on tab page in this fast example only simple links


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

@@Gergely It's a very practical idea for things like invoice and packing slip that invloves other actions, but other tasks may be faster if you just add a button (in my case change status, edit order or send email...). I've removed the default ones and added the ones I use. But your idea looks very nice for other tasks!

Share this post


Link to post
Share on other sites

@@piernas forget the old v2 code standards. Its changed in v2.4 and its a new concept from v3. No need buttons for edit order or send email or change status on the top but you can do it as mentioned before. These admin fuctions could be on tabs without any buttons in page header.

 

Look at an opencart example with left sided tabs:

 

https://www.fraudlabspro.com/images/supported-platforms/opencart_preview1.png


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

@@Gergely I've just tested this and the code produces a redirection loop on page load.

 

I'm trying to figure out how to activate again the current tab after a page refresh from the browser. Any ideas?

 

 

 

Opened Tab stabilisation after actions in redirection link

 

 

action.php

    function execute() {


      tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit#section_my_hook_name_content'));
    }

tab.php

<div id="section_my_hook_name_content" style="padding: 10px;">
  {$content}
</div>

Share this post


Link to post
Share on other sites

@@piernas

Example code has a loop of course. There should be hook self action handling..
 

    function execute() {
      global $action, $messageStack;

      if (tep_not_null($action)) {
        switch ($action) {
          case 'my_hook_action':


            tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit#section_my_hook_name_content'));
            break;
        }
      }

    }

or something like similar


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Very effective content array edition by this way:

simple method:

// Modular SEO Header Tags
  include( DIR_WS_MODULES . 'header_tags/categories_insert.php' );
// Modular SEO Header Tags


hook method:

    echo $OSCOM_Hooks->call('categories', 'categoriesContent');


I have added a new listen:

    function listen_categoriesContent() {
      if ( !class_exists('page_seo_hook_admin_categories_content') ) {
        include(DIR_FS_CATALOG . 'includes/apps/page_seo/hooks/admin/page_seo/content.php');
      }

      $hook = new page_seo_hook_admin_categories_content();

      return $hook->execute();
    }

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Ok. Before all tep_redirect() should use at admin side in all main file action sections the following program code:

$OSCOM_Hooks->call('pagename', 'pagenameAction');
tep_redirect(....);

documentation


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

×