Jump to content
Sign in to follow this  
misa

Margin Report v1.00

Recommended Posts

When I want to sort on manufactures I am getting page not found.

Wheren can I fix this?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

It isn't that, its in fimenames, I have got the same problem with making a csv file

Share this post


Link to post
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?

Share this post


Link to post
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. "

Share this post


Link to post
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

Share this post


Link to post
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.';

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

read what I wrote above. You need to change the variable to the folder that you want to save it into. Note that you will have to include the complete root directory path to the folder.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

oops sorry

 

It downloaded to c:\\inkoop\inkoop.csv

 

I often typo / and \

 

Tim


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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Still got the csv problem..............

 

I created in C: a new director y called inkoop but still got the error

Share this post


Link to post
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

Share this post


Link to post
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:\\ ?

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Glad everyone likes it.

 

Tim, I'll look into that.

 

As for the problems...I'll look into those too.

 

Thanks,


Chris Sullivan

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×