Jump to content

Add tab in orders


Claudia M

Recommended Posts

When looking at an individual order in admin I'd like to add a new tab with my custom information.  I have my information added to the notes tab now ( using 2 columns) and it works fine except the save button is in the middle of the information.  I'd send a photo but there's a lot of customer info in it.  Can someone steer me in the right direction to add a custom tab please?

Thanks in advance,

Claudia

PS:  Some of the custom fields are already in CubeCart some I have added to the order.summary database

Link to comment
Share on other sites

Snippet #1:

Enabled: checked
Unique ID: specialorderdata@cubecart6
Execution Order: 1
Description: Adds a tab to display special order data on it's own content pane
Trigger: admin.tabs
Version: 1.0
Author: https://forums.cubecart.com/topic/55583-add-tab-in-orders/
PHP Code:
<?php
if($_GET['_g'] == 'orders' && (!isset($_GET['node']) || $_GET['node'] == 'index') && isset($_GET['action']) && in_array($_GET['action'], array('add','edit'))) {
  $tab['name'] = 'Special Data';
  $tab['tab_id'] = 'tab_specialdata';
  $tab['target'] = '#specialdata';
  $tabs[] = $tab;
}

Snippet #2:

Enabled: checked
Unique ID: specialorderdatapane@cubecart
Execution Order: 1
Description: Adds a pane of HTML showing the special data
Trigger: admin.order.index.display
Version: 1.0
Author: https://forums.cubecart.com/topic/55583-add-tab-in-orders/
PHP Code:
<?php
## Put all of the PHP code that processes the special data here.
## Assign to Smarty template variables. For example,
$GLOBALS['smarty']->assign('DIV_PANE_ID', "specialdata");

##
## Put the admin skin template code here. Use Smarty template code to automate the contents.
## Using PHP's NowDoc format, the following div pane is an example of the Smarty template HTML.
$specialDataDivPane = <<<'DIVPANE'
	<div id="{$DIV_PANE_ID}" class="tab_content">
	<h3>Special Data</h3>
	<fieldset>
		<legend>Special Data Group 1</legend>
		<div>
			<label>Data Item 1</label><span>Data Item 1 Value</span>
		</div>
	</fieldset>
	</div>
DIVPANE;
$specialDataDivPaneCompiled = $GLOBALS['smarty']->fetch('string:'.$specialDataDivPane);

##
## Pass the compiled HTML to a dedicated array.
$smarty_data['plugin_tabs'][] = $specialDataDivPaneCompiled

Hopefully, this works. I may have some edits later when I try this for real shortly.

Link to comment
Share on other sites

I deleted the first snippet and can't get in my admin.  Just get a white screen.  Do you know what this snippet is?  It says it was created today at around 2 pm.  I didn't create it.

<?php
  $return_filenames = array_map(function($element){return $element['filename'];},$return);
  array_multisort($return_filenames,$return);
?>

Link to comment
Share on other sites

I do not recognize it.

 

If you are looking at the file in the /includes/extra/ folder, the snippet gets recreated after each clearing of the cache. The version cc628 now deletes the snippets when CubeCart clears its cache. Manually deleting the snippet file does not remove it from the database. (Clicking the Delete icon in the list of snippets will delete it, however.)

The database table CubeCart_code_snippet does not record when the snippet was inserted into the table.

Link to comment
Share on other sites

I have the snippets installed now but how do I input the information.  Here is an example of what I'm doing.  It shows in 2 columns

class= my_width is 590px

 <div class="my_information" style="width: 1200px;">
            <fieldset class="my_width" id="my_left">
           <legend>Summary: Product Information</legend>
            {if !empty($OVERVIEW_SUMMARY.excel_product_name)}<label for="excel_product_name">Excel Product Name:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$OVERVIEW_SUMMARY.excel_product_name}<br>{/if}
            {if !empty($OVERVIEW_SUMMARY.excel_product_code)}<label for="excel_product_code">Excel Product Code:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$OVERVIEW_SUMMARY.excel_product_code}<br>{/if}
             </fieldset>
 <fieldset class="my_right">
              <legend>Product Information</legend>
 <div><label for="excel_product_name">Excel Product Name</label><span><input type="text" id="excel_product_name" name="summary[excel_product_name]" value="{$SUMMARY.excel_product_name}" class="textbox"></span></div>
    <div><label for="excel_product_code">Excel Product Code</label><span><input type="text" id="excel_product_code" name="summary[excel_product_code]" value="{$SUMMARY.excel_product_code}" class="textbox"></span></div>
            </fieldset>
            
           <fieldset class="my_width" id="my-left">
             <legend>Summary: Pricing Information</legend>
            {if !empty($OVERVIEW_SUMMARY.subtotal)}<label for="order_price">Order Price:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$OVERVIEW_SUMMARY.subtotal}<br>{/if}
         {if !empty($OVERVIEW_SUMMARY.shipping)}<label for="sold_site">Shipping:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$OVERVIEW_SUMMARY.shipping}<br>{/if}
          {if !empty($OVERVIEW_SUMMARY.site_discount)}<label for="site_taxes">Total Discount:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$OVERVIEW_SUMMARY.site_discount}<br>{/if}
  {if !empty($OVERVIEW_SUMMARY.site_taxes)}<label for="site_taxes">Total Taxes:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$OVERVIEW_SUMMARY.site_taxes}<br>{/if}
          {if !empty($OVERVIEW_SUMMARY.total)}<label for="total">Grand Total:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$OVERVIEW_SUMMARY.total}{/if}
             </fieldset>
          <fieldset class="my_right">
                    <legend>Pricing Information</legend>
 <div><label for="subtotal">Store Price</label><span>{$OVERVIEW_SUMMARY.subtotal}</span></div>
 <div><label for="shipping">Store Shipping</label><span>{$OVERVIEW_SUMMARY.shipping}</span></div>
 <div><label for="site_discount">Site Discount</label><span><input type="text" id="site_discount" name="summary[site_discount]" value="{$SUMMARY.site_discount}" class="textbox"></span></div>
   <div><label for="site_taxes">Total Taxes</label><span><input type="text" id="site_taxes" name="summary[site_taxes]" value="{$SUMMARY.site_taxes}" class="textbox"></span></div>
   <div><label for="total">Grand Total</label><span>{$OVERVIEW_SUMMARY.total}</span></div>
            </fieldset>

 

Link to comment
Share on other sites

Now I add the code (see above) to the admin/skin/order.index file affixing it to the "notes" tab. But I wanted its own tab because I use it in 2 columns and the save button was showing in the middle and not allowing my columns to line up.

Yes I wanted to know how to modify the snippet to show the information

Capture-order-index.png.b3b669652eb0ebbf50080474c7f322d9.png

 

1187308837_Captureorderindex.thumb.PNG.aa92d1ba8c40e20795614feb0fc139e1.PNG

Link to comment
Share on other sites

Grab all of what you added to the Notes section of the template, and move it to the snippet:

Between these two lines:

$specialDataDivPane = <<<'DIVPANE'

and:

DIVPANE;

There will be a few tweaks to that template code. The opening <div> needs id="specialdata". (And I think you didn't paste all of the custom code. Am I right?)

Link to comment
Share on other sites

The save reload button has disappeared from the notes tab and the save button is still in the center of my code on the Special Tab.  Here's the beginning and end of the info I put in the snippet.

# Using PHP's NowDoc format, the following div pane is an example of the Smarty template HTML.
$specialDataDivPane = <<<'DIVPANE'
    <div id="specialdata" class="tab_content">
    <h3>Special Data</h3>
         <div class="my_information" style="width: 1200px;">
            <fieldset class="my_width" id="my_left">

--------------------------

<div><label for="weight">AIOS Order Weight</label><span>{$OVERVIEW_SUMMARY.weight}</span></div>
          <div><label  for="ship_product">Shipping Paid For</label><span>{$OVERVIEW_SUMMARY.ship_product}</span></div>
            <div><label for="shipping_used">Shipping Used</label><span><input type="text" id="shipping_used" name="summary[shipping_used]" value="{$SUMMARY.shipping_used}" class="textbox"></span></div>
            <div><label for="shipping_zone">Shipping Zone</label><span><input type="text" id="shipping_zone" name="summary[shipping_zone]" value="{$SUMMARY.shipping_zone}" class="textbox"></span></div>
   </fieldset>
 </div>
DIVPANE;
$specialDataDivPaneCompiled = $GLOBALS['smarty']->fetch('string:'.$specialDataDivPane);

##
## Pass the compiled HTML to a dedicated array.
$smarty_data['plugin_tabs'][] = $specialDataDivPaneCompiled;

 

 

 

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...