Problem with CSV in pro module for inventory

Open to all! Ask other shopowners for help.
Post Reply
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Problem with CSV in pro module for inventory

Post by 14Steve14 »

Version 1.0.8.20
PHP version 1.8.21

I have added a few new columns into the admin/stats_inventory.php file to include some of the other data stored in the database after adding other Pro modules such as Cost Price and MSRP. On the admin backend when opening the file it shows correctly with all the new headings and columns showing all the correct information, so working as it should.

The problem comes when clicking on the Create CSV button. For some reason the csv that is created does not include all the new column and I cannot figure out why. I have cleared the server cache, computer cache and cannot see anything in the page code that should make it only show the original columns.

Can someone test this just to see whether its me or a problem with the code, or maybe I am just plain missing something somewhere.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4561
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 413 times

Re: Problem with CSV in pro module for inventory

Post by burt »

Code: Select all

// array of SOME of the data to be injected into spreadsheet
// you can add more data in here if you like.  If you do then make sure that you also add a heading (see L34 of this file) in the correct place - the new heading can be hardcoded rather than a TABLE_HEADING_XYZ.
Did you add in your column data here?
I am not here to build for you.
I am here to build with you. Let's help each other.
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Problem with CSV in pro module for inventory

Post by 14Steve14 »

burt wrote: Sun Sep 10, 2023 8:23 pm

Code: Select all

// array of SOME of the data to be injected into spreadsheet
// you can add more data in here if you like.  If you do then make sure that you also add a heading (see L34 of this file) in the correct place - the new heading can be hardcoded rather than a TABLE_HEADING_XYZ.
Did you add in your column data here?
Gary @burt

The initial bit of code you have above which is commented out is actually missing from the file, but I did add all the new entries needed in a block as it all shows on the page, but not when creating the CSV.

In the latest version 1.0.8.20 there is only one block of code, where as in the earlier version 1.0.7.11 I use there are two blocks of code, one for the page and one for the CSV I assume. I take it something has been updated.
User avatar
burt
Core Team
Posts: 4561
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 413 times

Re: Problem with CSV in pro module for inventory

Post by burt »

Looks like it moved to the action file;

admin/includes/actions/stats_inventory/csv.php

Similar idea though.
I am not here to build for you.
I am here to build with you. Let's help each other.
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Problem with CSV in pro module for inventory

Post by 14Steve14 »

Cheers @burt Gary

never thought of looking there. Thought it would all be in the same file for some reason or maybe some note in the original file that a bit has been moved.

I will have a play with that file now and make a note somewhere about the change.
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Problem with CSV in pro module for inventory

Post by ecartz »

14Steve14 wrote: Mon Sep 11, 2023 9:08 am some note in the original file that a bit has been moved.
This pattern is common in admin files now. Look for

Code: Select all

  require 'includes/segments/process_action.php';
to see if it is present. Or just look in admin/includes/actions/[page-name]/

The point of this is to allow add-ons to add new actions without having to modify code. They can just drop a new file for the new action rather than ask you to modify the existing file.


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