Jump to content
blueline

Margin Report v2.10

Recommended Posts

I have added the txt instruction to the contribution...hope this will help promote this great contribution more and get more support for it later!


Best regards,

Koh Kho King

Share this post


Link to post
Share on other sites

I am getting this error on my categories page now

 

1054 - Unknown column '201_207' in 'where clause'

 

SELECT * from products_to_categories where categories_id=201_207

 

[TEP STOP]

 

any help will be appreciated

Share this post


Link to post
Share on other sites

when i look at the margin report it shows many of the items twice.

 

Can anyone help

 

Mike

Share this post


Link to post
Share on other sites
I have re-installed 2.56 and still get

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #29' at line 1

 

Resource id #29

 

[TEP STOP]

 

when I select a Manufacture and then do a All Catagories by Manufacture. Otherwise the other reports work.

 

Did anyone actually reply to this at all? I see it posted twice. If so, I cannot find it in the thread. I have installed Margin Report and have exactly the same problem. Weird thing is that if you select a product from the All Categories by Manufacturer drop down menu the export works fine for the product. When you then reselect All Categories by Manufacturer and select export it works! It appears to be only the first time you go there from the main margin reports page that it does not get the sql right and throws the error. Something not being passed somewhere on initial call?

 

Also, I noted refrerence to a fix for the quantity issue that is supposed to be in the thread. Have just gone though and cannot see it. Have I missed it?

 

Thanks

 

Peter

Share this post


Link to post
Share on other sites
Did anyone actually reply to this at all? I see it posted twice. If so, I cannot find it in the thread. I have installed Margin Report and have exactly the same problem. Weird thing is that if you select a product from the All Categories by Manufacturer drop down menu the export works fine for the product. When you then reselect All Categories by Manufacturer and select export it works! It appears to be only the first time you go there from the main margin reports page that it does not get the sql right and throws the error. Something not being passed somewhere on initial call?

 

Also, I noted refrerence to a fix for the quantity issue that is supposed to be in the thread. Have just gone though and cannot see it. Have I missed it?

 

Thanks

 

Peter

 

Now OK on the quantity issue. Still have the 1064 bug though. Anyone any ideas?

 

Thanks

Share this post


Link to post
Share on other sites

Are there any issues with this contribution til this date?

 

Also, I suppose Margin Report will take into account that the cost of the goods may change? If I edit a products cost price Margin Report won't change the earlier reports but will regognize my new cost price for coming reports?

 

Find this useful, just want to check this. The shop I need to use it in sells items using several currencies, tax rates and both with and without tax depending on customers country.

 

Thanks!

Share this post


Link to post
Share on other sites

Fredrik,

The cost for each item should be being stored in each order individually. This was not the case with the first version of the contribution, but has been fixed for some time. So it is important to check and make sure when you do an order, the cost is being entered into the orders_products table for each item with a cost in your order.

 

Cheers,

 

VB

Share this post


Link to post
Share on other sites

i just installed this contribution and it's having some affects on my site.

 

for one, it's making my abstract, accessories, and msrp fields in the admin disappear. everytime i view a product in the admin they disappear so i have to re-enter them. they'll show up fine on the live site, but when i view it again in the admin it disappears. if i save without re-entering the info, it disappears from the live site. has anyone had this problem?

Edited by NimaP

Share this post


Link to post
Share on other sites

check the edits you did in your admin/categories.php file...especially all the db queries and db writes. That's where the problems are at.


I only do what my Rice Krispies tell me to do!

Share this post


Link to post
Share on other sites

Guys,

I am getting this error on checkout can anybody help me please?

 

1366 - Incorrect decimal value: '' for column 'products_cost' at row 1

 

insert into orders_products (orders_id, products_id, products_model, products_name, products_price, products_cost, final_price, products_tax, products_quantity, vendors_id) values ('3025', '200', 'A60HR', 'A60HR - 60,000 BTU Portable Forced-Air Kerosene Heater

*Factory Reconditioned 30-Day Warranty', '139.00', '', '139', '0', '1', '3')

 

[TEP STOP]

 

I have already ran both of these on the database which executes succesfully

 

ALTER TABLE `products` ADD `products_cost` DECIMAL( 15, 4 ) DEFAULT '0.0000' NOT NULL AFTER `products_price` ;

ALTER TABLE `orders_products` ADD `products_price` DECIMAL( 15, 4 ) DEFAULT '0.0000' NOT NULL AFTER `products_cost`;

Edited by xearoth

Share this post


Link to post
Share on other sites

I'm having problems with this great contribution. In Admin everything works fine. But in the store I got problems. When the customer checkout he gets a blank page.

 

Can you help me ?

Share this post


Link to post
Share on other sites

I think I found the problem with the blank page when customer starts to checkout. I have some products with attributes. I deleted all attributes from my database, and it starts to work just fine.

Any chance to margin report works with products attributes?

 

Thanks.

Share this post


Link to post
Share on other sites

Not really :'(

 

I get the first checkout screen. The things only works fine when I use the original order.php and checkout_process.php (without the margin report modifications), in catalog/includes/classes (and without products attributes).

 

Help ?

Share this post


Link to post
Share on other sites
Guys,

I am getting this error on checkout can anybody help me please?

 

1366 - Incorrect decimal value: '' for column 'products_cost' at row 1

 

insert into orders_products (orders_id, products_id, products_model, products_name, products_price, products_cost, final_price, products_tax, products_quantity, vendors_id) values ('3025', '200', 'A60HR', 'A60HR - 60,000 BTU Portable Forced-Air Kerosene Heater

*Factory Reconditioned 30-Day Warranty', '139.00', '', '139', '0', '1', '3')

 

[TEP STOP]

 

I have already ran both of these on the database which executes succesfully

 

ALTER TABLE `products` ADD `products_cost` DECIMAL( 15, 4 ) DEFAULT '0.0000' NOT NULL AFTER `products_price` ;

ALTER TABLE `orders_products` ADD `products_price` DECIMAL( 15, 4 ) DEFAULT '0.0000' NOT NULL AFTER `products_cost`;

 

Can anybody please help me with this? My shop is down

Share this post


Link to post
Share on other sites

Has anyone run this mod along with Easy populate. Would be handy if you could do this in a spreadsheet, upload it via easy populate as all the hard work is done then


Things still to do before going "live" in no real order...

Change "buy now buttons" css styles

Change "lets see what we have here" into something meaningfull

Main logo of the website

Sort out currency to make site UK only (at present)

Remove "xx requests since" stuff

Update mainpage :D

Move shopping cart status into header

Add in stock status to product listing page

Define styles for product listing standardisation

Change CSS background for Headings

Increase Category size headings

Used mods so far:- basic_design_pack1mk7 | Google XML sitemap w admin | Paypal IPN v 1.2 | Feedmachine | pricematch_1_3_1 | Dynamic Sitemap 1.6 | Whos online Enhancement | Easypopulate 2.72

 

Each one that I solve I;ll be putting a post on the forum in a "completed shop" thread that Im writing up

Share this post


Link to post
Share on other sites
Can anybody please help me with this? My shop is down

 

I think the problem is with the value '139.00'. It should be '139,00'. Why? Maybe some configuration that changed the decimal separator?... :huh:

 

...

*Factory Reconditioned 30-Day Warranty', '139.00', '', '139', '0', '1', '3')

Share this post


Link to post
Share on other sites

Ok i saw this posted here like 50 times.... and being that i spent a good hour or teo going through the posts here looking for an answer most of the answers i found were in pieces and didnt fix the problem

 

 

Ok so everyone is asking how come the cost isnt being shown in the reports...

 

 

very simple follow the below instructions... THEY HAVE BEEN CORRECTED as there was an error in them

 

here is the edited and fixed instructions for the latest version of MARGIN REPORTS

 

 ################################################################################
############################
################################################################################
############################
### 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?fd 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_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'],

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!

 

 

if you do this correctly THIS will work!

 

I even managed to include the Retail Price contribution with this..

Share this post


Link to post
Share on other sites

Hello,

 

I need your help please.

When I try to acces margin_report.php from admin I receive this message error:

 

Fatal error: Call to undefined function: tep_output_string() in ..../admin/margin_report.php on line 230

 

Can you help me ?

 

At line 230 is:

 

$sort_prefix = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('page', 'info', 'sort')) . 'page=1&sort=' . $colnum . ($sortby == $colnum . 'a' ? 'd' : 'a')) . '" title="' . tep_output_string(TEXT_SORT_PRODUCTS . ($sortby == $colnum . 'd' || substr($sortby, 0, 1) != $colnum ? TEXT_ASCENDINGLY : TEXT_DESCENDINGLY) . TEXT_BY . $heading) . '">' ;

 

 

Thanks

Share this post


Link to post
Share on other sites

Will this fantastic contribution work with product attributes? I have Set Attributes Plus installed.

I think I read somewhere that there were problems with product attributes.

 

Thank you.

Share this post


Link to post
Share on other sites

Hi, i use products attributes too and Margin Report does not calculate the atributes prices.

 

Is it possible to work with products attributes?

 

Thanks for this great contrib!

Share this post


Link to post
Share on other sites
when i look at the margin report it shows many of the items twice.

 

Can anyone help

 

Mike

This is the case for me too. Is there a way to make the queries filter the products so that any duplicates are not taken into the report? I have a lot of products that are placed in more than one catgory... :huh:

 

/Magnus

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

×