Created
October 17, 2022 12:15
-
-
Save unlocomqx/d3cf4a90a8e5a41fc5be65b9de33c4db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Pseudo code | |
// Attibute quantity coefficient map | |
// it only contains attrA and attrB because other attributes are more dynamic | |
$attr_qty_map = array( | |
'attrA' => 1, | |
'attrB' => 2, | |
'attrE' => 0, | |
); | |
// dynamic qty | |
$attr_qty_map['attrC'] = $other_field * $oplage; | |
$attr_qty_map['attrD'] = $dynamic_field * 10 + $oplage; | |
if ($field_checkbox) { | |
$attr_qty_map['attrE'] = $oplage * 10; | |
} | |
// I pass in 'attrA', but it should be $id_attriute_A | |
$attibute_attrA = getTierPrice('attrA', $attr_qty_map['attrA']); | |
$attibute_attrB = getTierPrice('attrB', $attr_qty_map['attrB']); | |
$attibute_attrC = getTierPrice('attrC', $attr_qty_map['attrC']); | |
$attibute_attrD = getTierPrice('attrD', $attr_qty_map['attrD']); | |
$attibute_attrE = getTierPrice('attrE', $attr_qty_map['attrE']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment