Jump to content
blueline

Margin Report v2.10

Recommended Posts

Hi all

 

Can the instruction.pdf file be uploaded into a txt format so that we can copy and paste all needed change. Instead of having to retype all the php code agian.

 

Thanks

urbach

Share this post


Link to post
Share on other sites

Great Contribution, but I seem to have some problems.

 

I have installed the Family Products contribution on my shop. It seems that these contributions are not compatible with each other, they both require modifications in /admin/categories.php

 

At this moment I can run the reports of margin_report.php fine but I'm unable to edit my categories. When I want to edit my catalog true the admin panel I simply see the admin menu and no categories to edit. Has anyone seen this before?

 

Perhaps I should install Margin Report before the Family products contribution?

 

Keep on the good work Chris, this is the best add-on i've seen in a while!

Tip: get rid of the .pfd-document, it misses the line-breaks. I think a text file is better. (No offense offcourse :D )

Share this post


Link to post
Share on other sites

Funny you should mention Family Products...as I wrote both of these contributions. I have tested them and they both work well together. As the admin/categories.php file is used when editing and/or creating a new product, many changes are made here. None of them should actually effect the others though.

 

And I will get a new install file out as soon as I get a chance.


Chris Sullivan

Share this post


Link to post
Share on other sites

Ha, I never noticed these contributions have the same developer. It's great to know that they don't bite eachother.

 

I'll try another install and hope it will work. Thx

Share this post


Link to post
Share on other sites

I tried a clean installation with this contribution and it works perfect now.

 

I think I've fould a little bug/issue in the Installation file.

It is about the file /admin/categories.php

On page 3 the install instruction says:

 

Find: 
'products_price' => '', 

Replace With:
'products_price' => '',
'products_cost' => '',

 

And on page 4 it says:

 

Find: 
if ($action == 'new_product') { 

$parameters = array('products_name' => '', 
products_description' => '', 
'products_url' => '', 
'products_id' => '',
'products_quantity' => '',
'products_model' => '', 
'products_image' => '', 
'products_price' => '',

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

 

This is both abouth the same array, so one of these comments could be left out I think? Am I right or do I mis something here?

Share this post


Link to post
Share on other sites

The installation instructions have some duplicates. I put the instructions together very fast to get the release out there...and obviously there are some problems. Perfect example as to why MS3 is taking so long.

 

Anyways, you are right...just ignore one of them.

 

-Chris


Chris Sullivan

Share this post


Link to post
Share on other sites

Okay, perfect.

 

Since I didn't like copying from the .PDF-document I've put it in a text-document. I might as well share it with you guys. I don;t know how to put it in an contribution and i think Chris is the person to do this, so here it is:

 

################################################################################
############################
################################################################################
############################
### Margin Report v2.56 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### Official Support Thread http://forums.oscommerce.com/index.php?showtopic=99144 ? ? ? ? ? ? ? ? ? ? ? ###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### If you find this contribution useful and would like to make a donation ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ###
### so that I can continue to build contributions for the community such as this one and Family Products.###
### Thanks and I hope you find this contribution useful. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### -Chris (a.k.a. blueline) P.S. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### If you find this contribution useful I?d like to hear about it. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### You can email me at osc@eclyptiq.com and let me know what you think. Thanks again. ? ? ? ? ? ? ? ? ? ###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### Margin Report v2.56 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### Installation Instructions ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### Files included: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/admin/margin_report.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ###
### /catalog/admin/margin_report2.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/admin/languages/english/margin_report.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ###
### /catalog/admin/languages/english/images/buttons/button_export.gif ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/admin/languages/turkish/margin_report.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ###
### /catalog/admin/languages/turkish/images/buttons/button_export.gif ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### Margin Report v2.56.sql ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### Files to Edit: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/admin/categories.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/admin/includes/languages/english/categories.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ###
### /catalog/admin/includes/languages/english.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/admin/includes/boxes/reports.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/admin/includes/filenames.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/includes/classes/order.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/includes/classes/shopping_cart.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### /catalog/checkout_process.php ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
### ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?###
################################################################################
############################
################################################################################
############################
Installation Instructions


/catalog/admin/categories.php 
Find: 
? ? ? ? ?<tr bgcolor="#ebebff">
? ? ? ? ? ?<td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>
? ? ? ? ? ?<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>
? ? ? ? ?</tr>

Replace 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> 
? <tr bgcolor="#ebebff"> 
? ? <td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td> 
? ? <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>
? </tr>

Find:
? ?if (isset($HTTP_GET_VARS['search'])) {
? ? ?$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");
? ?} else {
? ? ?$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");
? ?}

Replace With:
? ?if (isset($HTTP_GET_VARS['search'])) {
? ? ?$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_cost, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name"); 
? ?} else { 
? ? ? ? $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_cost, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name"); 
? ?}
? ?
Find: 
? ? ? ? ? ? ? ? ? ? ? 'products_price' => '',

Replace With:
? ? ? ? ? ? ? ? ? ? ? 'products_price' => '',
? ? ? ? ? ? ? ? ? ? ? 'products_cost' => '', 

Find:
? ? ? ? ? ?$contents[] = array('text' => '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br>' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity);

Replace With:
? ? ? ? ? ?$contents[] = array('text' => '<br>' . TEXT_PRODUCTS_COST_INFO . ' ' . $currencies->format($pInfo->products_cost) . '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br><br>' . TEXT_PRODUCTS_PROFIT_INFO . ' ' . $currencies->format($pInfo->products_price-$pInfo->products_cost) . '<br><br>' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity); ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? ? 
Find:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

Replace With:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_cost' => tep_db_prepare_input($HTTP_POST_VARS['products_cost']),

Find:
? ? ? ? ? ?} 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();
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Replace With:
? ? } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
? ? $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_cost, 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_cost, 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']) . "', '" . tep_db_input($product['products_cost']) . "', 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();

Find:
? ?if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
? ? ?$product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
? ? ?$product = tep_db_fetch_array($product_query);

Replace With:
? ?if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
? ? ?$product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_cost, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"); 
? ? ?$product = tep_db_fetch_array($product_query);


/catalog/admin/includes/languages/english/categories.php

Add: 
?define('TEXT_PRODUCTS_COST_INFO', 'Cost: '); 
?define('TEXT_PRODUCTS_PROFIT_INFO', 'Profit:'); 
?define('TEXT_PRODUCTS_PRICE_COST', 'Products Price (Cost):');

Also add these lines to other languages you are using. ?

/catalog/admin/includes/languages/english.php

Find: 
?define('BOX_REPORTS_ORDERS_TOTAL', 'Customer Orders-Total'); 
?
Replace With: 
?define('BOX_REPORTS_MARGIN_REPORT', 'Margin Report'); 
?define('BOX_REPORTS_ORDERS_TOTAL', 'Customer Orders-Total'); ?
?
?Also replace these lines to other languages you are using.

/catalog/admin/includes/boxes/reports.php

Find:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? '<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>');	

Replace With:
? ? ? '<a href="' . tep_href_link(FILENAME_MARGIN_REPORT, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_MARGIN_REPORT . '</a><br>' . 
? ? ? '<a href="' . tep_href_link(FILENAME_STATS_CUSTOMERS, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_REPORTS_ORDERS_TOTAL . '</a>');

/catalog/admin/includes/filenames.php
Add:
?define('FILENAME_MARGIN_REPORT', 'margin_report.php');
?define('FILENAME_MARGIN_REPORT2', 'margin_report2.php'); ?

/catalog/includes/classes/order.php
Find:
? ? ?$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
? ? ?while ($orders_products = tep_db_fetch_array($orders_products_query)) {
? ? ? ?$this->products[$index] = array('qty' => $orders_products['products_quantity'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'id' => $orders_products['products_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $orders_products['products_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'model' => $orders_products['products_model'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax' => $orders_products['products_tax'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'price' => $orders_products['products_price'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'final_price' => $orders_products['final_price']);

Replace With:
? ? ?$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); 
? ? ?while ($orders_products = tep_db_fetch_array($orders_products_query)) {
? ? ? ?$this->products[$index] = array('qty' => $orders_products['products_quantity'], 
? ? ? ? ? ? ? ? ? 'id' => $orders_products['products_id'], 
? ? ? ? ? ? ? ? ? 'name' => $orders_products['products_name'], 
? ? ? ? ? ? ? ? ? 'model' => $orders_products['products_model'], 
? ? ? ? ? ? ? ? ? 'tax' => $orders_products['products_tax'], 
? ? ? ? ? ? ? ? ? 'price' => $orders_products['products_price'], 
? ? ? ? ? ? ? ? ? 'cost' => $orders_products['products_cost'], 
? ? ? ? ? ? ? ? ? 'final_price' => $orders_products['final_price'],

Find:
? ? ? ?$this->products[$index] = array('qty' => $products[$i]['quantity'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $products[$i]['name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'model' => $products[$i]['model'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'price' => $products[$i]['price'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'weight' => $products[$i]['weight'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'id' => $products[$i]['id']);

Replace With:
$this->products[$index] = array('qty' => $products[$i]['quantity'], 
? ?	'name' => $products[$i]['name'], 
? ?	'model' => $products[$i]['model'], 
? ?	'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 
? ?	'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']), 
? ?	'price' => $products[$i]['price'], 
? ?	'cost' => $products[$i]['cost'], 
? ?	'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), 
? ?	'weight' => $products[$i]['weight'], 
? ?	'id' => $products[$i]['id']);

/catalog/includes/classes/shopping_cart.php

Find:
// products price
? ? ? ?$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
? ? ? ?if ($product = tep_db_fetch_array($product_query)) {
? ? ? ? ?$prid = $product['products_id'];
? ? ? ? ?$products_tax = tep_get_tax_rate($product['products_tax_class_id']);
? ? ? ? ?$products_price = $product['products_price'];
? ? ? ? ?$products_weight = $product['products_weight'];

Replace With:
// products price 
$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); 
if ($product = tep_db_fetch_array($product_query)) { 
? $prid = $product['products_id']; 
? $products_tax = tep_get_tax_rate($product['products_tax_class_id']); 
? $products_price = $product['products_price']; 
? $products_cost = $product['products_cost']; 
? $products_weight = $product['products_weight'];
? 
Find:
? ? ?while (list($products_id, ) = each($this->contents)) {
? ? ? ?$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); ?

Replace With:
? ? ?while (list($products_id, ) = each($this->contents)) {
? ? ?	$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_cost, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); ? ? ? ? ? ? ? ?

Find:
? ? ? ? ?$products_array[] = array('id' => $products_id,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $products['products_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'model' => $products['products_model'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'image' => $products['products_image'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'price' => $products_price,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'quantity' => $this->contents[$products_id]['qty'],
Replace With:
? $products_array[] = array('id' => $products_id, 
? ? ? ? ?'name' => $products['products_name'], 
? ? ? ? ?'model' => $products['products_model'], 
? ? ? ? ?'image' => $products['products_image'], 
? ? ? ? ?'price' => $products_price, 
? ? ? ? ?'cost' => $products['products_cost'], 
? ? ? ? ?'quantity' => $this->contents[$products_id]['qty'], 

/catalog/checkout_process.php

Find:
? ?$sql_data_array = array('orders_id' => $insert_id, 
? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_id' => tep_get_prid($order->products[$i]['id']), 
? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_model' => $order->products[$i]['model'], 
? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_name' => $order->products[$i]['name'], 
? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_price' => $order->products[$i]['price'], 
? ? ? ? ? ? ? ? ? ? ? ? ? ?'final_price' => $order->products[$i]['final_price'], 
? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_tax' => $order->products[$i]['tax'], 
? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_quantity' => $order->products[$i]['qty']);

Replace With:
? ?$sql_data_array = array('orders_id' => $insert_id, 
? ? ? ? ? 'products_id' => tep_get_prid($order->products[$i]['id']), 
? ? ? ? ? 'products_model' => $order->products[$i]['model'], 
? ? ? ? ? 'products_name' => $order->products[$i]['name'], 
? ? ? ? ? 'products_price' => $order->products[$i]['price'], 
? ? ? ? ? 'products_cost' => $order->products[$i]['cost'], 
? ? ? ? ? 'final_price' => $order->products[$i]['final_price'], 
? ? ? ? ? 'products_tax' => $order->products[$i]['tax'], 
? ? ? ? ? 'products_quantity' => $order->products[$i]['qty']); ? 
? ? ? ? ? 
Save and close all files

mySQL Instructions:
Run mySQL Command by copying the code below OR using the included .sql file: 

# Margin Report v2.56 SQL File
ALTER TABLE `products` ADD `products_cost` DECIMAL( 15, 4 ) DEFAULT '0.0000' NOT NULL AFTER `products_price`;
ALTER TABLE `orders_products` ADD `products_cost` DECIMAL( 15, 4 ) DEFAULT '0.0000' NOT NULL AFTER `products_price`;

Done!

 

I can also mail it you blueline if needed. Hope you enjoy the instructions.

 

Sorry for screwing up the screen :o

Edited by RedShark

Share this post


Link to post
Share on other sites

Would it be possible to have the reports in all different currencies used in the catalogue with a selection by pull down menu?

Share this post


Link to post
Share on other sites

Hi.

I installed the mod a while ago.

I have the followng in the admin Categories / Products pages.

 

 

Date Added: 04/03/2004

Last Modified: 04/03/2004

 

 

glacierschenillehologoldblack.jpg

 

TEXT_PRODUCTS_COST_INFO 0

Price: 0

 

Profit: 0

 

Quantity: 2

 

Average Rating: 0.00%

 

 

Can any one tel me what ive done wrong for the TEXT_PRODUCTS_COST_INFO 0

to show and the price and profit showing at zero.

 

Keep smiling

Colin

Share this post


Link to post
Share on other sites

I just instlled the v2.56 and it seems to work great. Thanks for a great piece of work!

 

I noticed a couple of small glitches in the installation documentation and wanted to post them so they might make into the next version.

 

Page 3: <<< Find "products_price' => '', >>> is duplicated three 3 sets later with the section looking for <<< Find "if ($action == 'new_product') {" >>>

 

Page 7: The first edit in /includes/classes/order.php seems to be missing a term in the first line of the "Replace With:" code. It needs "products_cost, " inserted into the field list.

 

Page 8: The same problem as above is in the first edit in shopping_cart.php also. Needs "products_cost, " added to the field list.

 

Thanks again for a great mod!!

 

-- Dan

Share this post


Link to post
Share on other sites

Maybe a dumb question... how do I get weekly reports for different weeks? Or daily reports for other days? Am I missing somehting obvious?

 

Thanks in advance!

 

-- Dan

Share this post


Link to post
Share on other sites

Hi

I am really new to this PHP thing and have a couple questions. Please be patient with my questions if they sound dumb.

 

I am working with the latest version of osc but I am using multiple store contribution version 1.6

 

I have successfully added and modified everything to work except one thing; when an order is completed, the cost is not added to the order_products table. Everything from the order is there except the cost. I don?t know if this is due to the modifications made for the multiple store to function or I have missed something.

 

The margin reports work perfectly when I add the cost to the order_products table.

 

Here are my questions;

 

What file handles pulling the products_cost value out of the tables and what is that statement?

 

Where does the actual insert take place into the order_products table, I mean what file and actual statement where this takes place?

 

Thanks in advance

 

Greg

Share this post


Link to post
Share on other sites

Seems this doesn't want to work for me. I installed this contrib using the installation instructions and I get the following error when I click on Margin Report in the Admin control panel:

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in store/admin/includes/functions/database.php:13) in store/admin/includes/functions/database.php on line 13

 

I checked the store/admin/margin_report.php but it doesn't seem to list tep_db_connect anywhere so I am at a loss as to why this won't work for me. Someone have any pointers for me?

 

Thanks

Mick

Share this post


Link to post
Share on other sites

Well, after doing a side-by-side comparison of install instructions from v2.51 to v2.56 and correcting errors as I found them by using bug fixes from this forum, as well as, reinstalling the included files from v2.56, things are now working. Don't know if it was the errors in the installation notes I corrected or the reinstallation of the included files that did the trick.

 

BTW, I found the Adobe Acrobat Reader "Save As Text" function of the original v2.56 installation instructions pdf file, put in several errors. Not sure why, but a big thank you to Redshark for converting it to text as I used his contrib as a basis for my corrections.

 

These are the items I changed from his text file:

 

/catalog/includes/classes/order.php

 

Replace With:

$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_cost, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

'id' => $orders_products['products_id'],

'name' => $orders_products['products_name'],

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'cost' => $orders_products['products_cost'],

'final_price' => $orders_products['final_price']);

 

// Added "products_cost, " to the "$orders_products_query =" line and added a ");" to the end of the "'final_price' " line instead of a ",".

 

 

/catalog/includes/classes/shopping_cart.php

 

Replace With:

// products price

$product_query = tep_db_query("select products_id, products_price, products_cost, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

if ($product = tep_db_fetch_array($product_query)) {

$prid = $product['products_id'];

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

$products_price = $product['products_price'];

$products_cost = $product['products_cost'];

$products_weight = $product['products_weight'];

 

// Added "products_cost, " to the "$products_query =" line.

 

 

Hope this is correct and helps others who have a similar problem.

 

Mick

Share this post


Link to post
Share on other sites

Upon selecting Export button from the main Margin Report window, I get the following error:

 

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

 

Are there any changes that I need to make to the margin_report2.php file to allow exporting of data?

 

Also, if I select a Daily (or other type) report, I am given the option to Open, Save or Cancel. Open and Cancel work OK, but I can't Save because MSIE comes up with an error saying it cannot open this Internet Site. I noticed someone else in this forum had a similar problem but no one has yet provided a solution. Any takers?

 

 

My final problem is with how the Price and Special Price is reported in the Margin Report. It seems that the Margin Report reports the Products Price (Net) price instead of the Products Price (Gross) price in the Price and Specials Price fields (ie. it doesn't include the tax on these prices.) This leads to an error in Margin ($) and Margin (%) fields because the Products Price (Cost) price for me is a Gross price (includes taxes and any fees I was charged). Here is an example of what I mean:

 

Product+ Cost Price Special Price Margin ($) Margin (%)

Book 20.00 31.77 19.95 $-0.05 -0.25%

 

Clearly, not what I want and makes the margin report useless for me.

 

What it should read is:

Product+ Cost Price Special Price Margin ($) Margin (%)

Book 20.00 34.95 21.95 $1.95 9.75%

 

Being an Australian shop, almost everything has a Goods and Services Tax (GST) of 10% applied by the use of the Tax Class option on the Products page which then requires me to use of the Products Price (Gross) field in most calculations. Even stuff which doesn't attract a GST still requires me to use the Products Price (Gross) field because in this case it would be the same as the Products Price (Net) field.

 

Can someone tell me what I need to change in margin_report2.php to show Gross instead of Net.

 

 

Thanks in advance

 

Mick

Edited by MickK

Share this post


Link to post
Share on other sites

I have heard that Service Pack 2 has caused some, otherwise non-existent, problems. That may be why you can't save.

 

Unfortunately I don't have time to modify this contribution to everyone's needs, but with a little trial and error I am sure you can modify this for your specs. Otherwise, I hope there is someone available that has time to modify this contribution to fit your needs.

 

Thanks

-Chris


Chris Sullivan

Share this post


Link to post
Share on other sites
I have heard that Service Pack 2 has caused some, otherwise non-existent, problems. That may be why you can't save.

 

Unfortunately I don't have time to modify this contribution to everyone's needs, but with a little trial and error I am sure you can modify this for your specs. Otherwise, I hope there is someone available that has time to modify this contribution to fit your needs.

 

Thanks

-Chris

 

 

You are probably right about SP2. I will have to investigate further.

 

As to modifying the code, sorry I am PHP illiterate. I guess an easy quick fix solution for my situation rather than modifying code for taxes etc. is for some kind person to point out where in margin_report.php and margin_report2.php I can simply add "*1.1" (multiply by 1.1) to the displayed Price, Special Price and possibly Sales Amount fields. This would certainly solve my problem.

 

Cheers

Mick

Share this post


Link to post
Share on other sites

Well, I have changed the way I record the cost price in my shop so I no longer need the Margin Report modified to report taxes. I made minor changes to the titles of the Margin Report to reflect ex-tax prices and all seems to be working OK now except the issue with the exporting and saving of the CSV file.

 

In anycase, my question for today is - I would like to know if future versions of margin_report2.php will include a drop down to choose the Order Status for the report. The reason for this is because like so many other shops, I use the Order Status to reflect whether or not an order is still outstanding or completed or even cancelled. Currently, the Margin Report lists them all, which in the case of incomplete or cancelled orders, doesn't give a true representation of your gross profit or your sales figures. I guess if it was to be incorporated, it would be an AND operation to whatever type of report was chosen.

 

Example:

This report is for the week beginning: Sunday, October 24, 2004 with Order Status of "Completed".

 

This would show all orders for the week starting Sun, Oct 24 that have a status of "Completed" within those dates. For this to occur, I guess you would have to use the orders_status_history table and the fields orders_status_id and date_added. Hope that kinda explains why it would be a good thing to have.

 

Cheers

Mick

Share this post


Link to post
Share on other sites

Does anyone know if this contribution is available built into a clean build anywhere? From reading this thread it seems like there are a few issues with the installation instructions. If someone had a clean / working copy of the relevant files (and was willing to post them with the contribution) it would make it very easy to install using a diff editor.

 

Thanks in advance

 

Simon

Share this post


Link to post
Share on other sites
Does anyone know if this contribution is available built into a clean build anywhere?  From reading this thread it seems like there are a few issues with the installation instructions.  If someone had a clean / working copy of the relevant files (and was willing to post them with the contribution) it would make it very easy to install using a diff editor.

 

Thanks in advance

 

Simon

 

I did not read al the new replies but when you just take my installation post a while ago and download the files of the contribution, you should be able to make a proper installation though.

Share this post


Link to post
Share on other sites

I have another problem. Whenever I try to create a All Catagories by Manufacture report I receive this error

 

1064 - You have an error in your SQL syntax near 'Resource id #29' at line 1

 

Resource id #29

 

All other reports seem to work just fine.

Share this post


Link to post
Share on other sites

Hi Chris:

 

Excelent Contribution!

 

I find a bug:

 

Our products have diferent price using "attributes_price" (Products Attributes)

 

This is a example:

 

ID Product Name Option Name Option Value Value Price Prefix Action

 

3472 *Frank Quintero Greatest Hits FORMAT VHS 7.0000

3471 *Frank Quintero Greatest Hits FORMAT DVD 0.0000

 

The Frank Quintero Greatest full price is 25 (DVD) but in VHS is 7

 

When display a montly report with "Margin Report v 2.56b" show Frank Quintero Greatest Hits full price (25) but don't display the correct price (7).

 

Please send me a feedback about this

 

THANKS A LOT

 

Omar

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

×