Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Margin Report v1.00


Guest

Recommended Posts

Hey thanks for bringing this up. I have never sorted before so I had not noticed it not working. After I read your post I went to take a look and sure enough, when I use the drop down sort box I got a page not found. So I fixed it.

 

Place this line in admin/includes.filenames.php

 

define('FILENAME_MARGIN_REPORT', 'margin_report.php');

 

If my problem is the same as yours that should fix you up.

 

Tim Fortune

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

Sorry I made a typo up above.

 

The file is in admin/includes/filenames.php

 

When you sort in margin report or export the CSV file the script margin_report.php is calling helper script within the same file so there is absolutly noway the file could be missing.

 

Now take a look at the install instructions and the margin_report.php script and you will see why this occurs.

 

In boxes reports.php the script calls the file like so:

 

'<a href="' . tep_href_link(FILENAME_STATS_MARGIN_REPORT, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_MARGIN_REPORT . '</a><br>' .

 

and the install instructions, at the end say to put this line into filenames.php like so:

 

/includes/filenames.php

Add:

// Cost Module v1.11

define('FILENAME_STATS_MARGIN_REPORT', 'margin_report.php');

 

Now if you look at the script margin_report.php around line 525 you will clearly see they call the export button script as such:

 

tep_draw_form('export_to_file', FILENAME_MARGIN_REPORT, 'get', '') .

 

but if you followed the installation the call named FILENAME_MARGIN_REPORT was never defined in the filenames.php. The install said to define it as:

 

define('FILENAME_STATS_MARGIN_REPORT', 'margin_report.php');

 

see the difference.

 

This has to be your problem.

 

Open admin/includes/filenames.php

 

and insert this line:

 

define('FILENAME_MARGIN_REPORT', 'margin_report.php');

 

and it will work.

 

You must define margin_report both ways:

 

'FILENAME_MARGIN_REPORT', 'margin_report.php');

'FILENAME_STATS_MARGIN_REPORT', 'margin_report.php');

 

or change the script margin_report.php

 

Tim Fortune

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

So far so good but ik still can't select maufatures and when it want to create a fiel its returning:

 

"Please enter a valid filename and check your location. "

Link to comment
Share on other sites

Yes...there were some install errors in the contribution. Also, to have your export work properly, you need to go into the marging_report.php file and change the $Base_folder to where you want the file to save into.

Edited by safoo
Link to comment
Share on other sites

Here is a part of margin_report about the csv file:

 

// Please change this to the folder you want to use.

// If you are using Windows, you must use \\ instead of \.

$Base_folder = "C:\\inkoop";

//////////////////////////////////////////////////////////////

$filename = $Base_folder . $HTTP_GET_VARS['file'];

$file = fopen($filename, 'inkoop');

fwrite($file, $csv);

fclose($file);

echo 'Your exported csv file has been saved at: ' . $filename;

} else {

echo 'Please enter a valid filename and check your location.';

Link to comment
Share on other sites

Misa,

 

To fix the problem of the error when selecting a manufacturer, go into admin/margin_report.php around line 291, find the code:

 

tep_draw_form('filter', 'margin_report', '', 'get')

 

and change to

 

tep_draw_form('filter', 'margin_report.php', '', 'get')

Edited by safoo
Link to comment
Share on other sites

Ok Safoo.....................that did it thank you very much.

 

No still have to fix to make a csv file without getting the error:

 

 

 

Please enter a valid filename and check your location.

Link to comment
Share on other sites

I copied and pasted your code into my file

 

created a directory on my c drive called inkoop

 

hit the export button and typed in inkoop.csv

 

and the script successfully generarted my margin report and downloaded it to

 

c://inkoop/inkoop.csv

 

So if you are still having problems that section of code is not the problem

 

Tim Fortune

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

I have to make another small apology.

 

After reading the post by safoo I recall a long while back fixing my script to reflect the file name issue and while I was in there I changed it to be defined in filenames .php hence the post I made above.

 

Evidently I changed the original contrib file I downloaded also and I normally don't do this so I always have an original script.

 

My most humble apologies to all.

 

Maybe it's time to throw in the towel for the day. My typing is terrible and my questions are not getting answered.

 

I have learned a few things today so all is not in shame.

 

Tim Fortune

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

Tim,

 

It works for you because your OSC is hoted on a local machine. For those of us that have our OSC on remote servers (99% of the users), they will need to specify the download folder using the variable $Base_folder in margin_report.php.

 

Still, this is a very useful report and I never even saw it before the update that was posted in the contributions section today. It will help me a lot on my site.

Edited by safoo
Link to comment
Share on other sites

It sure is a good contibution.

 

This is now what I got in my margin_report.php

 

 

$Base_folder = "C:\\inkoop";

 

Do I have to put more in front or after the C:\\ ?

Link to comment
Share on other sites

Maybe this is saying anything more:

 

 

Warning: fopen(C:\inkoop): failed to open stream: No such file or directory in /home/bruinenfit.nl/public_html/www.bruinenfit.nl/admin/margin_report.php on line 245

 

Warning: fwrite(): supplied argument is not a valid stream resource in /home/bruinenfit.nl/public_html/www.bruinenfit.nl/admin/margin_report.php on line 246

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/bruinenfit.nl/public_html/www.bruinenfit.nl/admin/margin_report.php on line 247

Link to comment
Share on other sites

Well I think we have a functional solution

 

I created a directory under admin called log and chmod 777

 

I changed $Base_folder = "log/";

 

and got rid of the errors and the file backed up to admin/log/

 

I am not happy with this though. I think it should be downloaded to my local machine.

 

How can this be fixed?

 

I tried several methods of defineing that $Base_folder

 

Tim

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

Hey all. I wrote the contribution....sorry about the inconsistency within the code and defined filenames.

 

-Chris

 

P.S. I am thinking about expanding the functionality of this contribution to allow reports to be made based on daily, weekly, monthly, quarterly, and annual sales. Anybody interested?

Chris Sullivan

Link to comment
Share on other sites

Hi Chris,

 

As you can see we have been battling with this thing all morning and have resolved several issues. I just came across your original thread and posted there.

 

We are not able to download to our local machines from the web. My store and the contrib work great on my local server but trying to download from the web fails.

 

Could you bail us out?

 

Thanks,

 

Tim

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

Chris I think the added functionality would work well and allow for easier analysis of the numbers.

 

I really liked that idea that was posted back in the original support thread about being able to plug a number into any one of the spots and have osc generate the other numbers for you.

 

I have talked with alot of people that seem to have no concept of profit/loss, margin, markup, discount. This was the main reason I jumped on this contrib the minute I came across it. Very nice job indeed.

 

The store owners I have built stores for really appreciate having that module available. I think it is one of the most impressive modules in the admin panel. To be able to see that info at a glance is very very cool and can be a real butt saver if you happen to make a typo and don't catch it. Your module kind of waves a flag and says "Hello we have a problem here Houston".

 

Speaking of that maybe you could add in a color coded marker if a product is set belowa certain margin that can be defined in admin.

 

Tim

How do you know when you know what you want to do for the rest of your life?

Link to comment
Share on other sites

blueline,

 

the added functionality would be great if you could tie them into sales since right now it just deals with the margins of particular products. Still, the report is very practical.

 

masat, you can't have it directly download to your local machine since the server is remote. The way it works is to create a file on your remote server which you can then download and save to your local machine. As I mentioned earlier, you will need to go into the file and change the path from C:\ to the directory on your machine. If then you get errors about not being able to open or write to the files, try changing the chmod of the directory folder you specified.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...