Hello,
Please Note: Tiered pricing is not welcome!! (it takes to long).
I have a bit of a complex project which involves generating scaled pricing on products depending on the customers search query specifications & the minimum & maximum prices my suppliers state.
Please check out this url for a clear visual explanation: [login to view URL]
As you can see, I have created a brief design of what I want. The buttons are not yet working & the layout is not exactly how I want yet.
My aim is for the customer to be able to quickly enter the "name" of a product & specify either the quantity they are after or their budget. The customer must only be able to insert data into one of the 2 text boxes, when they insert data into one box, the other text box must become locked & vice versa.
The point of having one box become locked is because the customer is wanting to know the answer of the locked box & this is what we will calculate.
Example 1:
Name: Potassium Nitrate
Quantity (Kg/Ltr): 250
Budget ($): "locked"
Example 2:
Name: Potassium Nitrate
Quantity (Kg/Ltr): "locked"
Budget ($): 800
Once the customer has input their specifications, they hit the "Find Matching Products" button.
This is where it gets tricky. Each product matching the customer specifications must be displayed with scaled pricing.
Please view below coding for more detail about this:
//Working Variables - Used in displaying price ranges & order quantity ranges
//MOQ means "minimum order quantity"
//BPQ means "best price quantity"
//UOM means "unit of measure"- Kg/Ltr
//Variables used for displaying product data
$Unit_Size = $_product->getResource()->getAttribute('weight')->getFrontend()->getValue($_product);
$UOM = $_product->getResource()->getAttribute('uom')->getFrontend()->getValue($_product);
$MOQ_Units = $_product->getResource()->getAttribute('moq_units')->getFrontend()->getValue($_product);
$BPQ_Units = $_product->getResource()->getAttribute('bpq_units')->getFrontend()->getValue($_product);
$MOQ_Unit_Price = $_product->getResource()->getAttribute('moq_unit_price')->getFrontend()->getValue($_product);
$BPQ_Unit_Price = $_product->getResource()->getAttribute('bpq_unit_price')->getFrontend()->getValue($_product);
$MOQ_Weight = $MOQ_Units*$Unit_Size;
$BPQ_Weight = $BPQ_Units*$Unit_Size;
$MOQ_Unit_Price_formatted = number_format($MOQ_Unit_Price, 2, '.', '');
$BPQ_Unit_Price_formatted = number_format($BPQ_Unit_Price, 2, '.', '');
//Variables used for scaled pricing
// Specifies if quantity is greater or smaller than MOQ
//$Reach_Moq = Quantity/($MOQ_Units * $Unit_Size)
//Value Decrement per additional unit purchased
//$Unit_Decrement = number_format((($MOQ_Unit_Price-$BPQ_Unit_Price)/($BPQ_Units-$MOQ_Units)), 2, '.', '')
// Customer demanded units
//$Quantity_Units = Quantity/$Unit_Size
// Calculates the best price offer for the quantity specified
//$Scaled_Pricing = number_format(($MOQ_Unit_Price)-(($Quantity_Units - $MOQ_Units)*$Unit_Decrement), 2, '.', '')
You may start to understand what I am trying to do. When customer inserts their specifications & clicks the "calculate quote" or "find matching products" buttons, we will automatically calculate the best price or quantity depending on their specifications.
Please let me know if you understand...it is quite complex.
Thanks,
Jason