Jump to content

vaughnn

Members
  • Content count

    25
  • Joined

  • Last visited

Profile Information

  • Real Name
    Vaughnn
  1. vaughnn

    Margin Report v2.10

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

    Margin Report v2.10

    That's because in the sql you should have products_cost not product_cost!!!
  3. vaughnn

    Margin Report v2.10

    A couple of keys to this mod. I have it running OK. The issue with the cost not working is related to some missing code for when the order is saved into the order table, need to ensure the cost field is in the orders table (as described a lot earlier in this thread). For those having issues with quantities, you need to find the mod in this thread which updates the reports to do some quantity calculations. This is a great contribution which should be able to be a standard feature of OSC. Vaughnn
  4. Folks, I am sure I have seen this somewhere previously... What I am looking for is a contribution that allows you to set which payment methods a customer is shown. So each customer can have the payment types defined specifically for them, allowing some to be allowed to see the Pay on Invoice option and others not. Thanks in advance for any help, Vaughnn
  5. I use the On the Fly Thumbnailer, but would love a way of fixing images when uploading. So when a user has a big image (ie 1024x1280) it can resize to a specified amount - and delete any copy of the original large image. Any ideas??
  6. vaughnn

    Timed delivery module

    Yes, this would be great. I have looked at other contributions, but modifying these looks challenging. VB
  7. vaughnn

    Margin Report v2.10

    Well my changes above should fix the matter of recording the cost price at sales time, and all that is left to fix after that should be a couple of minor changes to margin_report2 to give the correct information. Unfortunately if you have not got the cost history, margin_report2 will need to extract the info from current pricing costs, but these are relatively minor changes in margin_report2. Chris, I also had the issue of the qty not being used for calculating the total cost, and made some changes to the module. I have included an extract from my margin_report2 code, which fixed my qty issue. (Unfortunately I use a combination of oscommerce and phpnuke on my website [oscNuke], so when I add contributions I have to amend things to get them to work). My changes are as follows; for($i=0;$i<sizeof($o);$i++) { $price = 0; $cost = 0; $items_sold = 0; $prods_query = mysql_query("select products_id, products_price, products_cost, products_quantity from orders_products where orders_id = '" . $o[$i] . "'"); while ($prods = mysql_fetch_array($prods_query, MYSQL_ASSOC)) { $p[] = array($prods['products_id'], $prods['products_price'], $prods['products_cost'], $prods['products_quantity']); $price = $price + ($prods['products_price'] * $prods['products_quantity']); $cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); $items_sold = $items_sold + $prods['products_quantity']; $total_price = $total_price + ($prods['products_price'] * $prods['products_quantity']); $total_cost = $total_cost + ($prods['products_cost'] * $prods['products_quantity']); $total_items_sold = $total_items_sold + $prods['products_quantity']; } To fix the issue with the product cost issue on item sales where you did not save the cost price to the order_products table, I would do something like the following; REPLACE $cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); WITH if (!$prods['products_cost'] > 0) { $cost_query = mysql_query("select products_cost from products where products_id = '" . $prods['products_id'] . "'"); $cost_result = mysql_fetch_array($cost_query, MYSQL_ASSOC); $cost = $cost + ($cost['products_cost'] * $prods['products_quantity']); } else { $cost = $cost + ($prods['products_cost'] * $prods['products_quantity']); } I am a bit of a hack (and haven't tested this last change), but most things I have done work OK. Cheers folks, Vaughnn www.theITcrew.com.au
  8. vaughnn

    Margin Report v2.10

    OK, had a quick look and think the following is all that is required to make it work. You will need to make some changes to the margin report files, but these are changes to the standard files to allow saving of costs for each order. I hope these changes are ALL required (they at least worked for me). make the following database change; ALTER TABLE `orders_products` ADD `products_cost` DECIMAL( 15, 4 ) DEFAULT '0.0000' NOT NULL AFTER `products_price`; make the following changes to code; 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 // 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 'price' => $products[$i]['price'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), REPLACE WITH 'price' => $products[$i]['price'], 'cost' => $products[$i]['cost'], 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), includes/classes/shopping_cart.php 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, 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'], 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']); Cheers, VB
  9. vaughnn

    Margin Report v2.10

    Folks, This contribution is fantastic, but has one flaw for historical info which needs some time investigating. The cost of items is extracted from the products table when doing historical reports. If like me your items change in price regularly, or you buy the same item from multiple suppliers, the history reports over time become les and less accurate. I know that to fix this will need some changes to the orders_products table, to the checkout process, so the item cost is saved into the OP table on checkout. I can look at this, but make no promises, as have many other things on the go. Cheers, VB
  10. vaughnn

    Referral Point System

    Has anybody made any modifications to get this to award more than 1 pt per transaction?? I want to install a module like this so that I can have points given to customers based on what the people they refer purchase, ie if the referred customer purchases a $200 item the points awarded to the referrer is more than if it was $50. I also want to change where the point(s) are rewarded to after an order has had payment confirmed. So a temporary holding area for points would be my suggestion, as a status of pending. If anybody has made any changes to the module please let us know... Thanks, VB
×