Jump to content
blueline

Margin Report v2.10

Recommended Posts

I modified the V3.00b version to work with OSCommerce version 2.3.1 .

I Included language files in French (as it was within V3.00b) and Dutch (translated from the French one).

 

New download link can be found here:

http://addons.oscommerce.com/info/8147

 

As stated on that link, my PHP knowledge ain't that good, so giving support will be difficult (as I was lucky and got it working spot on).

Share this post


Link to post
Share on other sites

Hi

i have this mod for the 2.3.1 shop (the http://addons.oscommerce.com/info/8147 Contribution) and it works lovely except, it is not saving the cost price when i reopen edit product, it does however stay there if i dont touch the product, but now and again i have to edit the description and then it just disapears and i have to insert it again.

 

Any ideas ?

 

Thank you x

Share this post


Link to post
Share on other sites

@@clippers

 

I am currently looking for something like this, the add ons that I found were the one you found: http://addons.oscommerce.com/info/1594/v,22 and another that has the cost and margins mod http://addons.oscommerce.com/info/6242 but I could not get this one to work with 2.3.1.

 

I am looking to get this added and then get it to work with Easy Populate? Have you had any more luck with yours

Share this post


Link to post
Share on other sites

@@EchoGuns

 

i havent got it fixed yet, but i dont use easy populate, i have ajax attributes and qtpro, i think it has to be some thing simple such as its not being saved to the database when opened, have you had any luck yet?

Share this post


Link to post
Share on other sites

If your data is not being remembered from the data base you may have missed a bit of code in the admin categories somewhere. Make sure you have added products_cost, after or before products_price. There are also a few instances where you have to add p.products_cost, after p.products_price, And also check that you have again added 'products_cost' => '', after 'products_price' => '', in the if ($action == 'new_product') {

 

Also make sure that you have added the sql file code.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

hi 14steve14

 

thats what i did :-)

 

I missed out one p.products_cost, after installing Header Tags SEO and editing $product_query = tep_db_query,

 

All fixed now thank goodness, lol sometimes you have to stand back if the code goes all burry

 

the contribution works lovely now thank you

Edited by clippers

Share this post


Link to post
Share on other sites

Hi, I've downloaded the v3 version and after installing, my local taxes are not being added to my customer orders. I've looked at all the changes and I cannot see what it is that would cause it to not show during checkout or on the invoice. My taxes are based on the state of NC in the USA. If anyone has ideas, I'd love to hear them since I've had to back charge customers for taxes not taken out which is not good for business. :mellow: Thanks! - Steve

Share this post


Link to post
Share on other sites

OSCommerce 2.3.3 / Margin Report v3.00

 

I got the wwrong cost and margin % on the admin report page, every time I changed the cost or price for a product it changed the report. I did the following and it worked.

 

Line 223 margin_report2.php

 

$prods_query = mysql_query("select op.products_id, op.products_price, op.products_quantity, p.products_cost from orders_products op, products p where op.orders_id = '" . $o[$i] . "' and op.products_id = p.products_id");

 

change to

 

$prods_query = mysql_query("select op.products_id, op.products_price, op.products_quantity, op.products_cost from orders_products op, products p where op.orders_id = '" . $o[$i] . "' and op.products_id = p.products_id");

Share this post


Link to post
Share on other sites

Hi

 

Can anyone help.

 

I'm getting the following message when i click on 'reviews'

 

Warning: array_merge(): Argument #3 is not an array in /customers/9/2/d/misfitsbodypiercing.co.uk/httpd.www/catalog/admin/reviews.php on line 222 Warning: reset() expects parameter 1 to be array, null given in /customers/9/2/d/misfitsbodypiercing.co.uk/httpd.www/catalog/admin/includes/classes/object_info.php on line 17 Warning: Variable passed to each() is not an array or object in /customers/9/2/d/misfitsbodypiercing.co.uk/httpd.www/catalog/admin/includes/classes/object_info.php on line 18

Share this post


Link to post
Share on other sites

Hi

 

line 222 in reviews.php is

 

$rInfo_array = array_merge($reviews, $review_info, $products_image)

 

Error is telling you that $ products_image is not an array so maybe the lines above

 

$products_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$reviews['products_id'] . "'");

$products_image = tep_db_fetch_array($products_image_query);

 

are not getting a result (maybe a product with no image?)

Share this post


Link to post
Share on other sites

Hi, Anyone ever get this error... happens when I click on drop down bar. (daily, yesterday, etc)

Warning: mysql_query() [function.mysql-query]: Access denied for user 'tntsale3'@'localhost' (using password: NO) in /home/tntsale3/public_html/shop/office/margin_report2.php on line 34

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/tntsale3/public_html/shop/office/margin_report2.php on line 34

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tntsale3/public_html/shop/office/margin_report2.php on line 35

and more....

OScom 2.3.4

with QPBPP for SPPC

Edited by toughmama

Share this post


Link to post
Share on other sites

Problem solved... running 2.3.4 -

- need to change query in margin_report2.php

 

mysql_query to ==> tep_db_query

mysql_fetch_array to ==> tep_db_fetch_array

 

Thanks to George @ Mini Template System for solving this problem.

Share this post


Link to post
Share on other sites

Re. Duplicate products because some some product are listed/linked to different categories

Here is a fix for the margin_report.php to have single product listing.

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

 

Line 142

if (strpos($this->sql_query, 'distinct') || strpos($this->sql_query, 'group by')) {

//$count_string = 'distinct ' . tep_db_input($count_key);

$count_string = tep_db_input($count_key);

} else {

$count_string = tep_db_input($count_key);

}

 

=============

 

Line 405 - change to:

$listing_sql = "select p.products_id, p.products_price as products_price, p.products_cost, pd.products_name, IF(s.status, s.specials_new_products_price, NULL) as specials_price, if(s.status, s.specials_new_products_price-p.products_cost, p.products_price-p.products_cost) as margin_dollars, if(s.status, (s.specials_new_products_price-p.products_cost)/s.specials_new_products_price*100, (p.products_price-p.products_cost)/p.products_price*100) as margin_percentage from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'";

 

=============

 

Line 416 - change to:

 

$listing_sql = "select distinct p.products_id, p.products_price as products_price, p.products_cost, pd.products_name, IF(s.status, s.specials_new_products_price, NULL) as specials_price, if(s.status, s.specials_new_products_price-p.products_cost, p.products_price-p.products_cost) as margin_dollars, if(s.status, (s.specials_new_products_price-p.products_cost)/s.specials_new_products_price*100, (p.products_price-p.products_cost)/p.products_price*100) as margin_percentage from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id";

Share this post


Link to post
Share on other sites

Could someone please verify if these instructions are correct?

 

Should products_cost be in the $product_query? just seemed odd that its not, so wanted to check

 

/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'];


-Dave

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

×