S05e01 - Batch Actions QUESTIONS/SUPPORT

Open to all! Ask other shopowners for help.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: S05e01 - Batch Actions

Post by ecartz »

Maybe

Code: Select all

        'name' => TABLE_HEADING_ORDER_ID . new Tickable('select_all', ['value' => $row['orders_id'], 'onchange' => 'select_all()'], 'checkbox'),

Code: Select all

  <script>
  function select_all() {
    $.each($("input[name='actions_multi[]']"), function(){ $(this).val($("input[name='select_all']").val()); });
  }

  function batcher(file, where) {
One line modified; four lines added; two lines listed unchanged for context.

If that's not it, I'm sure someone could tweak something together.

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: S05e01 - Batch Actions

Post by 14Steve14 »

In need of a bit of help with this addon to make the download csv button show more information.

I have the table headings set up, which I believe was the easy bit, and can produce the table in the layout that I need to be able to bulk upload orders to a courier. I am having trouble getting it to show additional information such as customers_email_address and customers_telephone which are all available in the orders table.

I am assuming that its this bit that needs some form of editting. I am sure once I see how one bit of information is done, I will get the rest.

Code: Select all

$content[] = [$key,
                  $order->delivery['name'], 
                  $order->delivery['street_address'], 
                  $order->delivery['suburb'], 
                  $order->delivery['city'], 
                  $order->delivery['state'], 
                  $order->delivery['postcode'], 
                  $applied_weight, 
                  $order->info['shipping_method']];
  }
Can someone give a bit of guidance please as to how to get the information from the orders table to show in the CSV file that is generated.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: S05e01 - Batch Actions

Post by ecartz »

Code: Select all

           $GLOBALS['customer_data']->get('email_address', $order->customer),
           $GLOBALS['customer_data']->get('telephone', $order->customer),
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: S05e01 - Batch Actions

Post by 14Steve14 »

ecartz wrote: Wed Oct 26, 2022 6:19 pm

Code: Select all

           $GLOBALS['customer_data']->get('email_address', $order->customer),
           $GLOBALS['customer_data']->get('telephone', $order->customer),
Thanks for that. As it looks nothing like the code in the addon, is this something that can all be altered, or is the code above in addition to the current code.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: S05e01 - Batch Actions

Post by ecartz »

14Steve14 wrote: Wed Oct 26, 2022 6:31 pm in addition to the current code.
Just add those two lines where you want the email and telephone to appear in the code you posted. E.g. between postcode and weight.
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: S05e01 - Batch Actions

Post by 14Steve14 »

ecartz wrote: Wed Oct 26, 2022 8:04 pm
14Steve14 wrote: Wed Oct 26, 2022 6:31 pm in addition to the current code.
Just add those two lines where you want the email and telephone to appear in the code you posted. E.g. between postcode and weight.
Thanks for that. Now I should be able to get all the other data and change the order in the spreadsheet.
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: S05e01 - Batch Actions

Post by 14Steve14 »

14Steve14 wrote: Wed Oct 26, 2022 5:42 pm In need of a bit of help with this addon to make the download csv button show more information.

I have the table headings set up, which I believe was the easy bit, and can produce the table in the layout that I need to be able to bulk upload orders to a courier. I am having trouble getting it to show additional information such as customers_email_address and customers_telephone which are all available in the orders table.

I am assuming that its this bit that needs some form of editting. I am sure once I see how one bit of information is done, I will get the rest.

Code: Select all

$content[] = [$key,
                  $order->delivery['name'], 
                  $order->delivery['street_address'], 
                  $order->delivery['suburb'], 
                  $order->delivery['city'], 
                  $order->delivery['state'], 
                  $order->delivery['postcode'], 
                  $applied_weight, 
                  $order->info['shipping_method']];
  }
Can someone give a bit of guidance please as to how to get the information from the orders table to show in the CSV file that is generated.
@ecartz I hope you can help again.

Been looking at this again and now need to add in 'delivery_country'. No problems I thought. Just copy one line from above add in the right place, change 'state' to 'country' and hey presto. Wrong. It only shows the word array.

Is there something I am missing to get the delivery country to show? We need the CSV to show country to make it easy to spot international orders when uploading the file to RM click and drop.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: S05e01 - Batch Actions

Post by ecartz »

Code: Select all

           $GLOBALS['customer_data']->get('country_name', $order->delivery),
14Steve14
Senior Contributor
Posts: 922
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: S05e01 - Batch Actions

Post by 14Steve14 »

ecartz wrote: Tue Dec 20, 2022 11:46 am

Code: Select all

           $GLOBALS['customer_data']->get('country_name', $order->delivery),
I will give that a try and let you know how I get on.

Does this mean that all of the other data that is required can be called the same way, as even in the latest version it is all still coded the old way, which may have confused me.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: S05e01 - Batch Actions

Post by ecartz »

1. It should be able to work with customer data. I don't see why it would not. At worst, you might have to call it as Guarantor::ensure_global('customer_data') the first time that it is used.
2. In this specific case, you have to ask for country_name rather than country, as country is an array of things. Something like $order->delivery['country']['title'] might work too. But using country_name with the customer_data global is more reliable.

Using customer data is preferred because it knows how to load missing data. So you don't have to rely on another process to load the data first. It should be able to find it from what's already there.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply