Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Cost Module v1.00


blueline

Recommended Posts

Here's the error with 'r+' instead of 'w':

 

Warning: Unable to access C:\margin-report.csv in /home/httpd/vhosts/mysite.com/httpdocs/catalog/admin/margin_report.php on line 245

 

Warning: fopen("C:\margin-report.csv", "r+") - No such file or directory in /home/httpd/vhosts/mysite.com/httpdocs/catalog/admin/margin_report.php on line 245

 

Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/httpd/vhosts/mysite.com/httpdocs/catalog/admin/margin_report.php on line 246

 

Warning: fclose(): supplied argument is not a valid File-Handle resource in /home/httpd/vhosts/mysite.com/httpdocs/catalog/admin/margin_report.php on line 247

Your exported csv file has been saved at: C:\margin-report.csv

 

Thanks again, Chris!

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Chris,

 

It works ok it's just that the directory where the file is saved is wrong.

On my testing server the file I named 'test' is saved at c:\ instead of a directory of the website.

 

The file produced is indeed a workable CSV file

 

BTW. I use IIS with PHP.

 

Regards,

 

TaFfin

SIGnificant.....right?

Link to comment
Share on other sites

TaFfin, glad to hear that it is working. I actually made it so that the .csv file would be saved to the local machine instead of the server on purpose. Figured most people would want immediate access to the file.

 

Any suggestions?

-Chris

Chris Sullivan

Link to comment
Share on other sites

  • 2 months later...

Hi There,

 

I'm having a problem with the Margin Report Link in Admin>Reports. instead of producing the filename 'admin/margin_report.php' is just has:

 

admin/FILENAME_STATS_MARGIN_REPORT

 

I have checked all the files and define values and all seem okay.

 

Any ideas?

 

Regards

 

Mark.

Edited by aurora_gfx
Link to comment
Share on other sites

Hi Chris

 

This is a great mod... I have it working completely at the moment and I have also converted the $ to ? (as I'm in the UK).

 

The problem with the CVS is a filenames definition - you also will not be able to sort by manufacturer.

 

I cannot remember what needs to be changed as I never noted it! Sorry, but just make sure you have the same filename definiton throughout.

 

Chris I have Tax inclusive & Exclusive pricing on my site - margin reports only shows exclusive price for me - could you possibly add it to work out the inclusive price as well?

 

Also, could you make it sort by categories as well as manufacturers?

 

You have done great regardless!

 

Thank you

 

Jiten

Link to comment
Share on other sites

  • 1 month later...

I used this on a site and had no problems and everything worked fine but I just tried installing it again twice and I am getting the same error message when I go to admin/catalog

Categories / Products Status Action

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\web\demo\catalog\admin\includes\functions\database.php on line 99

 

I tried it both on a production server and a local test site and I received the exact same message.

 

Any ideas??

The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

Link to comment
Share on other sites

In my experience that means that there is either a SQL query in your select statement, or you have a typo when using mysq_fetch_array.

 

Double check those two things and I think you'll find your problem

 

-Chris

Chris Sullivan

Link to comment
Share on other sites

In my experience that means that there is either a SQL query in your select statement, or you have a typo when using mysq_fetch_array.

 

Double check those two things and I think you'll find your problem

 

-Chris

Thanks!! I went back and manually added the differences to the statments with select in them instead of cutting and pasting from the directions and that fixed the problem. Now that I think about it I had already made changes to those lines for another contribution last time I installed this and had to do it manually the first time which is why I did not have any problems.

The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

Link to comment
Share on other sites

  • 3 weeks later...
Why don't you tell me all the things you'd like this to do and I will see what I can do.

Thanks for your beautiful contribution, Chris! :)

 

It would be very useful if there will be also a gross profit report (per item and of course total), calculated by the amount of (item sold * item-money-margin).

Also, if possible, sometimes sellers receive some items from their vendors in different price (usually cheaper) after a while, so this profit report should be able to get this info, for example:

 

I bought from my vendor 10 DVD players for $150 each and I am selling them for $200 each, but after 3 days (when I already sold 6 DVDs) another vendor offer me the same DVDs for $100, so I buy from him 15 pcs. and add them to the stock, which is now 19 DVDs (the remaining 4 DVDs + the cheaper 10), and offer them in the same price like before - $200, or offer the whole 19 pcs. in a cheaper price.

The profit report should be able to calculate & reflect that obviously...

 

If you can do that, it would be awesome!

Thanks in advance.

Edited by dr_lucas
Link to comment
Share on other sites

Hi,

Just installed the margin report and have it all working apart from the csv report part.

When i click on the csv report link (link button or text doent show at all) the page is redirected to the following.

 

 

xxx://www.xxxxxxxxx/catalog/admin/FILENAME_MARGIN_REPORT?action=export&sql=select++p.products_id%2C+p.products_price+as+products_price%2C+p.products_cost%2C+pd.products_name%2C+IF%28s.status%2C+s.specials_new_products_price%2C+NULL%29+as+specials_price%2C+if%28s.status%2C+s.specials_new_products_price-p.products_cost%2C+p.products_price-p.products_cost%29+as+margin_dollars%2C+if%28s.status%2C+%28s.specials_new_products_price-p.products_cost%29%2Fs.specials_new_products_price*100%2C+%28p.products_price-p.products_cost%29%2Fp.products_price*100%29+as+margin_percentage%2C+p2c.categories_id+as+category%2C+c.parent_id+as+parent+from+products+p%2C+products_to_categories+p2c%2C+categories+c%2C+products_description+pd+left+join+specials+s+on+p.products_id+%3D+s.products_id+where+pd.language_id+%3D+%271%27+and+p.products_id+%3D+pd.products_id+and+p2c.products_id+%3D+p.products_id+and+c.categories_id+%3D+p2c.categories_id+order+by+pd.products_name&file=coityfov&submit.x=17&submit.y=11]

 

 

it doesnt produce the report.

Can any one help.

Keep smiling

Colin

Edited by segdoune
Link to comment
Share on other sites

Well, it's been so long since I wrote this contribution that I don't know for sure....but I don't remember the sql query being sent as a GET variable.....so I would double check that.

 

Also, you clearly don't have FILENAME_MARGIN_REPORT defined, otherwise your page would redirect as

xxx://www.xxxxxxxxx/catalog/admin/margin_report.php?action=export

instead of

xxx://www.xxxxxxxxx/catalog/admin/FILENAME_MARGIN_REPORT?action=export

 

HTH

Chris Sullivan

Link to comment
Share on other sites

Hi,

Getting there with this mod.

 

Got the link working nearly ok, Now receiving the following error,

 

Warning: fopen(C:\test2): failed to open stream: Permission denied in /home/coysoqjo/public_html/catalog/admin/margin_report.php on line 245

 

 

Appols about my lack of knowledge with php.

How can i fix this.

All help greatly appreaciated.

Keep smiling

Colin

Link to comment
Share on other sites

Hi Chris.

I appreaciate the help but I still cant get it to work.

Ive done all that you ask without any joy.

Is there any other things that you can think of.

Ive re checked all the code and it looks ok.

Keep smiling

Colin

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...