Magento - Mageworx Extended Orders - rearrange columns - magento

I have more or less inherited a Magento site, which seems to be using the Mageworx Extended Orders extension for the order grid in the admin area.
Client would like the columns to be rearranged, eg, move Email over beside Voucher. In the System Config you can select columns but there doesn't seem to be any way of ordering them. I have searched through the code and tried editing code\local\MageWorx\Adminhtml\Block\Orderspro\Sales\Order\Grid.php to no avail.
I also looked in the database but couldn't find a table which might have the columns selected so that I could order them.
Thanks.

As it happens it was that file, MageWorx\Adminhtml\Block\Orderspro\Sales\Order\Grid.php, that I needed to edit. I took out the loop and just commented out the fields I didn't want showing and put the rest in the required order

You can change it in the file: app/code/local/MageWorx/OrdersPro/Block/Adminhtml/Sales/Order/Grid.php in the _prepareColumns() method.
At the moment changing columns order is quite a challenge and can be done only this way:
$listColumns = $helper->getGridColumns();
$listColumnsChanged = $listColumns; // create a copy of $listColumns
$listColumnsChanged[0] = $listColumns[3];
$listColumnsChanged[3] = $listColumns[0]; // interchange the columns that have id 3 and 0
var_dump($listColumns); // var_dump will let you learn ID of the column you need
foreach ($listColumnsChanged as $column) { // change foreach for getting to $listColumnsChanged

Related

tabulator filter: ungroup filter results

in my tabulator table I group specific rows. When I load the page I keep the groupings closed, so that the user can open those grouping he is interested in. (see attached screenshot)
But I would like to automatically open the groupings, when the user applies a filter to any column of the table. (because in this case I want him to see the results on first glance and I do not want him to open the grouping manually) Do you know how I can set up this specific requirement?
Open grouping when applying a column filter in tabulator js
Thank you very much in advance.
Best regards
To check when the table is filtered you can use the dataFiltered callback, you would need to check through the filters passed into the callback to make sure that there are filters actually applied before carrying out your app logic.
var table = new Tabulator("#example-table", {
dataFiltered:function(filters, rows){
//filters - array of filters currently applied
//rows - array of row components that pass the filters
},
});
You could the use the getGroups function to return an array of the Group Components for the table, and the itterate through the list and open the groups using the show function:
table.getGroups().forEach(function(group){
group.show();
});
I hope that helps,
Cheers
Oli :)

Removing a dynamic list of columns in powerquery

I'm working on a tool to help my team identify changes in some data files. Long story short, i managed to put something together (I'm quite the beginner with powerquery and M) that works well but it lacks user friendliness.
Issue is that not all team members need the tool to check for differences in all columns (different people, different interests). In order to manage this i used the following to remove all the unneeded columns before doing the compare:
= Table.RemoveColumns(myTable,{"col1","col2","col3"... etc
This works but if you want to change the configuration you need to go into the code and modify the list.
My question is the following: Is there any way to integrate a dynamic list into this code? i.e. have that list of columns in an easy to use table, "tick/untick" the ones you want and have the code remove the rest?
If your intent is to allow the user to select columns without entering the query editor then you may benefit from using a parameter table as described here: http://www.excelguru.ca/blog/2014/11/26/building-a-parameter-table-for-power-query/ . You should be able to expose a 2colxNrow table to the user with some predefined column names/numbers. You can use data validation to constrain user inputs to a binary on/off behavior ( https://support.office.com/en-us/article/Apply-data-validation-to-cells-29fecbcc-d1b9-42c1-9d76-eff3ce5f7249 ).
( P.S. Based on the your description of your goals Inquire add-in may alread offer the functionality you are looking for )
Probably the easiest way is to use "Choose Columns" on the Home tab in the Query Editor and then rename the generated step like:
#"CHOOSE COLUMNS HERE ----->" = Table.SelectColumns(Source,{"Column1", "Column2", "Column3", "Column5", "Column7", "Column8", "Column9", "Column10"})
Then when you want to adjust the selected columns, you can press the small wheel to which the arrow is pointing, and a popup will show up from which you can do your (un)ticking.
Alternatively, if you use multiple queries with the same selection, you can create an additional query that outputs a list, like:
let
Source = Table.FromList(List.Transform({1..10}, each "Column" & Text.From(_)),null,{"Available Columns"}),
Transposed = Table.Transpose(Source),
#"CHOOSE COLUMNS HERE ----->" = Table.SelectColumns(Transposed,{"Column2", "Column3", "Column5", "Column6", "Column8", "Column9", "Column10"}),
TransposedBack = Table.Transpose(#"CHOOSE COLUMNS HERE ----->"),
ConvertedToList = TransposedBack[Column1]
in
ConvertedToList
And then use that list in your queries, like:
= Table.SelectColumns(#"Transposed Table",SelectedColumns)
where SelectedColumns is the name of the query with the selected columns.

Angular Data tables multiple row section headers

I have a table that is already listed in ascending desired order with two distinct sections and I want to add headers for each section but I'm not quite sure how to do so. I am using the directive Angular datatables and would like to have the end result have row titles like the "Status:New" and "Status:Open" in the example image below.
After much research, currently there is no supported way to fix rows in the middle of the specific table I'm working with.
Add something like this after your initial code for your table. Assuming you're using 2 tables.
var table1 = $("#your_top_table").DataTable({});
$(table.table().header()).append('<tr><td>Status: New</td></tr>');
var table2 = $("#your_bottom_table").DataTable({});
$(table2.table().header()).append('<tr><td>Status: Open</td></tr>');

Using multiple two column values to access database information

I am using Magento 1.7.0.2 and need to access information within my database. I have achieved this by
$params = $this->getRequest()->getParams();
$prefs = Mage::getModel('prefs/prefs')->setCurPage(1)
->setPageSize(1);
$prefs->load($params['id']);
$data = $prefs->getData();
But this is only selecting data by using a single column as a reference within my table and I need to use two columns to get a unique value.
How do I select those two columns and apply those values as the parameter required in the address bar?
In my reseearch I have looked at this and applied _query, but couldn't work out how to get it to work.
You have to query like this check following code and change as per your requirement
$Model =Mage::getModel('prefs/prefs')->getCollection();
$Model->addFieldToFilter('first_column',array('eq'=>'your_id'))
->addFieldToFilter('Second_column',array('eq'=>'Your_filter_data'));
$finalData = $Model->getData();

Custom Start Number for Order Numbers in Magento 1.5

How do I customise the starting number for orders, invoices etc in Magento 1.5?
From magento's forum:
by LindyKyaw (Magento Team Member), changing start number (through sql query):
There is a table in the database which stored increment id of order.
It is called “eav_entity_store” table.
You can check which entity type id belongs to which entity by looking at
eav_entity_type table.
You can run following query to update last increment id for the order.
update eav_entity_store
inner join eav_entity_type on eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
set eav_entity_store.increment_last_id=3001
where eav_entity_type.entity_type_code='order';
by FOOMAN (active contributor), changing start number (through db management tool) and removing "0"s at the beginning:
With a tool like phpmyadmin look at your database. In the table
eav_entity_type you will find all entity types listed. The one of interest to
change where the order number starts is order sales/order. Remember the
entity_type_id (in my install it is 11). To remove the leading zeros
(padding) set increment_pad_length to 1.
Next go to the table eav_entity_store. Look up the entity_type_id. Now you
can change the value of increment_prefix and increment_last_id. If you wanted to
have your next orderId to be 15000 set increment_last_id to 14999 and
increment_prefix to 0.
Additionally you need to make a copy of this file
/app/code/core/Mage/Eav/Model/Entity/Increment/Abstract.php
to
/app/code/local/Mage/Eav/Model/Entity/Increment/Abstract.php
public function getPadLength()
{
$padLength = $this->getData('pad_length');
if (empty($padLength)) {
$padLength = 0;
}
return $padLength;
}
...
public function format($id)
{
$result= str_pad((string)$id, $this->getPadLength(), $this->getPadChar(), STR_PAD_LEFT);
return $result;
} Hope That Helps
Actually with the newer versions (and probably in 1.5 as well), there is an easier way to change it. In PHPMyAdmin, or your mysql client, go to the eav_entity_type table. Locate the table in the entity_type_code column (probably order), and set the increment_pad_length to be whatever you would like, as well as the increment_pad_char.
Then you don't have to rewrite core code - a win-win.
JMax
Magento Order No
It's simple....
go to phpmyadmin
select your datbase and then select the table "eav_entity_store"
in this table, change the increment_last_id (for example, I have set 3456767 in my table)
after that I create a new order. Now my orders start from the number 346768
There is actually a good extension for accomplish this task.
It allows you to customize the order ID in a lot of different way:
for example you can use a combination of:
number like year,month,,day,hr,sec,
use a custom counter (you can decide the starting number )
a combination of all above methods
add some custom string in any position of the order ID
This is the ext. on Magento connect:
http://www.magentocommerce.com/magento-connect/custom-order-id-8210.html
I personally tried it and it very good ( works fine with all my payment methods and I had no issue at all )

Resources