Jump to content
Sign in to follow this  
blueline

[Contribution] Cost Module v1.00

Recommended Posts

Working hard for you guys. Trying to put out all the modules which I think are helpful. Let me know what you think.

 

This is a module that will allow you to see a full report on the margin of all of your products. You now enter the cost of the good (in the admin) when you are entering or editing products.

 

From there this report allows you to sort out your products, in the report, by Product name, cost, price, specials price, margin dollars, and margin percentage.

 

Hope you like it.

-Chris

 

http://www.oscommerce.com/community/contributions,1594


Chris Sullivan

Share this post


Link to post
Share on other sites

I've added it my 'to do list' for our website.

 

It's currently number 3612.


-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Share this post


Link to post
Share on other sites

I will put up a demo tongiht.

 

The nice thing is that it is a VERY EASY install.


Chris Sullivan

Share this post


Link to post
Share on other sites

margin_report.gif

 

Here is a screenshot. Doesn't look as profound with a cost of $0.00 for everything, but it will be beneficial for those who take the time to populate the cost of their products.

 

Let me know what you guys think

-Chris


Chris Sullivan

Share this post


Link to post
Share on other sites

Chris;

 

This looks like a nice additional feature to have, but a couple of questions:

 

Does anything in the add products page get affected other than just adding a field to enter the cost? (I've got a TON of contributions and custom changes in effect that touch that file)

 

Does it have a page split feature, search, dropdown box to select a given category, total (average) lines by whole store, category, sub-category?

 

I'm not being critical, just trying to anticipate the types of features that would make it easier to use.


... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Share this post


Link to post
Share on other sites

Got it installed and it looks great!

 

I have over 1,500 products so it will take time to get all the costs in.

 

1 suggestions if I may: This mod would be much better if you could sort by category. When dealing with allot of products it is hard to find a few of the samples I did.

Share this post


Link to post
Share on other sites

I am willing to add new features as you guys decide you want them. Post your ideas and I will put them to work.

 

Glad you like it.

-Chris


Chris Sullivan

Share this post


Link to post
Share on other sites

I've made my own version of this a couple of weeks ago, basicly the same thing , the only difference is in mine you can enter a cost, then a margin and it automaticly figures out price, or you can enter price and cost and it will automaticly calculate margin. If your interested in incorperating something like this for another realease or something, let me know and I'll send it to ya.

Edited by Anacrusis

Share this post


Link to post
Share on other sites

Cool contribution Chris, works fine here.

 

But since you asked for it, maybe it's nice to put totals in the margin_report.php.

 

Regards,

 

TaFfin


SIGnificant.....right?

Share this post


Link to post
Share on other sites

Excellent mod.

 

One think I'd like to see are some filters on the report. Things like Top XX Items by margin, Bottom XX items, Items between specified margin range, items added within a data range, items in specific category/sub-category, etc...

 

Maybe an option to export to csv.

 

Also make it so the item name is a link to the edit page.

 

How's that for ideas? :)

 

Again... great mod, I was looking for something like this for a while.

Edited by Anacrusis

Share this post


Link to post
Share on other sites
Excellent mod.

 

One think I'd like to see are some filters on the report. Things like Top XX Items by margin, Bottom XX items, Items between specified margin range, items added within a data range,  items in specific category/sub-category, etc...

 

Maybe an option to export to csv.

 

Also make it so the item name is a link to the edit page.

 

How's that for ideas? :)

 

Again... great mod, I was looking for something like this for a while.

 

 

Thanks for the kind words.

 

As far as the top XX items, and bottom XX items, you can simply do that by sorting the products in ascending/descending order based on your request (margin dollars, %, cost, price, specials price, or name).

 

The link - DONE.

 

Selecting by Manufacturer - DONE.

*Category by Manufacturer - DONE.

 

The CSV option - I will do it.

 

I will upload the new version after I get the CSV export set up.

 

-Chris

 

 

TaFfin - What totals are you talking about?


Chris Sullivan

Share this post


Link to post
Share on other sites

Nice! I know that you will have a few more options to this module soon!

 

Thanks - Good Job

Justin


A Rose from Concrete

Share this post


Link to post
Share on other sites

nice mod needs some twaeking if you have other mods installed that use the categories.php

 

I have the following mods installed

 

header tags

WYSIWYG 1.7

 

i added the cost control and get the

NaN
in the Products Price (Gross) field

 

hunting down the problem now will post when i find the problem


Signs of desperation wishing, hoping, praying, crossing fingers, toes, arms, legs, crossing eye?s, now tied in knots and can?t see if it did work. Is there a chiropractor available.

Share this post


Link to post
Share on other sites

Hey Chris, great mod! I am having a problem, however, with the Product's Cost -- I enter the cost of the product, but as soon as I preview and update, the cost goes to $0.00. I am trying to work around the WYSIWYG 1.7 and the Monthly Sales report mods. I noticed when I was changing the admin/categories.php file that I was missing or had already changed some of the pieces that I was supposed to replace, namely:

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
           $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
           $product = tep_db_fetch_array($product_query);

           tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
           $dup_products_id = tep_db_insert_id();

and

if ($action == 'new_product') {
   $parameters = array('products_name' => '',
                      'products_description' => '',
                      'products_url' => '',
                      'products_id' => '',
                      'products_quantity' => '',
                      'products_model' => '',
                      'products_image' => '',
                      'products_price' => '',

and

          } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
           $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
           $product = tep_db_fetch_array($product_query);

           tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
           $dup_products_id = tep_db_insert_id();

 

I'd be happy to send my categories.php file to you if that will help. Is this just too many mods to try to get to work together?

 

I am also having trouble with "NaN" in the Products Price (Gross) field. Thanks again for this great mod, Chris!

Share this post


Link to post
Share on other sites

To fix the NaN problem in the Gross Price box, replace:

 

 ? ? ? ? ?<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_COST; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_cost, ''); ?></td>
? ? ? ? ?</tr>

 

with:

 

 ? ? ? ? ?<tr bgcolor="#ebebff">
<td class="main"><?php echo TEXT_PRODUCTS_PRICE_COST; ?></td>
<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_cost', $pInfo->products_cost, ''); ?></td>
? ? ? ? ?</tr>

 

All you are changing is the products_price input field to products_cost

Edited by Proetorian

Share this post


Link to post
Share on other sites

Thanks, Proetorian! That fixed the "NaN" problem and the problem I was having with cost not updating, now it's working great! Thanks Chris and Proetorian!

 

Helen

Share this post


Link to post
Share on other sites

thank you for the fix on NaN problem


Signs of desperation wishing, hoping, praying, crossing fingers, toes, arms, legs, crossing eye?s, now tied in knots and can?t see if it did work. Is there a chiropractor available.

Share this post


Link to post
Share on other sites

Thanks Chris, looks great. In order to upgrade, do I need to make any changes other than replacing admin/margin_report.php and admin/includes/languages/english/margin_report.php?

Share this post


Link to post
Share on other sites

Thanks, Chris. It looks like in admin/margin_report.php you have FILENAME_MARGIN_REPORT instead of FILENAME_STATS_MARGIN_REPORT for all instances in this file. I'm also getting some errors:

 

Warning: fopen("C:\margin-report.csv", "w") - Permission denied 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

 

The file also isn't saving. Thanks!

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  

×