Would you like to be notified for every new articles? Please click HERE to subscribe for newsletter.

Different Item Sales Price For Each Customer In FrontAccounting

  • Posted on: 21 February 2016
  • By: admin

This is a simple tutorial based on my experience when customizing FrontAccounting. In some cases we may need to have different sales price for the same item but different customer. For the example, we want to sell Item 1 to Customer A with price 500, but for the same item we want to sell to Customer B with price 550. It's true we can edit that price manually when creating the Sales Order. But, it will be more efficient if we can do that automatically based to the data we had.

In order to achieve that objective, we have to do some modifications in the code. First, we have to add new table for storing item price for each customer. After that we have to modify the following files:

Make sure you have done the backup for your current code so you can rollback to your previous code if something unexpected happened.

  • inventory/manage/items.php
    We add new tab for customer price entry here.
  • inventory/prices_customer.php
    New page for managing customer price.
  • inventory/includes/db/items_prices_customer_db.inc
    New file for customer price CRUD process.
  • inventory/includes/inventory_db.inc
    The file for handling customer price, inventory/includes/db/items_prices_customer_db.inc will be included from here.
  • sales/includes/ui/sales_order_ui.inc
    Modify function sales_order_item_controls to pass customer id when calling get_kit_price function. This will result a different price for each customer.
  • sales/includes/sales_db.inc
    Modify the function get_price and get_kit_price to accept customer id parameter. This parameter will be used to get the price for each customer.
  • applications/inventory.php
    Add new menu in Inventory page so we can set customer price in an independent page.

All required files and SQL for creating new table is provided in the attachment below. For the SQL, please remember to adjust the table prefix according to your FrontAccounting settings.

Package icon FA-customer-price.zip23.87 KB

Add new comment

Limited HTML

  • Allowed HTML tags: <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.