Hi,
If I do not know how to do that I would be glad to help
I tried a lot of trial and error but I couldn’t get the result.
// What brands are available for this product
// We have created array of brands of products to search
$brands = array("a","b","c");
//entries of products to be searched
//If the first option is not available look for the next option
$entries = array("10","14","17");
// Floors where the panel is located
// The indexes here represent the block
$panel_floors = array(
"1" => "18,13,7,3,1",
"2" => "18,13,7,3,1"
);
// How many shafts are used in the block
// If there are 2 blocks, the products of the block will be multiplied by two.
// The indexes here represent the block
$number_of_shafts = array(
"1" => "1",
"2" => "2" // Since the number of shafts is 2, the products will be doubled
);
// How many switches are there in which block, in which board?
// If it is 1, 10X20, if 2, 10X30, if 3, 10X40 products with input and output will be searched.
// In the example below, the product of the 1st block 18th floor will be searched for 10X30
// In the example below, the product of the 1st block 3th floor will be searched for 10X30
// The indexes here represent the block
$number_switches_floor = array(
"1"=>array(
"18"=>2,"13"=>1,"7"=>1,"3"=>1,"1"=>1
),
"2"=>array(
"18"=>1,"13"=>1,"7"=>1,"3"=>2,"1"=>1
)
);
//I'm not sure if it's correct to create an array by pulling all products from the database beforehand
// Note: Not even 100 items, maybe 70-80
$products = array(
"0"=>['id'=>1,'inputxoutput'=>'10X20','decibel_loss'=>'-20'],
"1"=>['id'=>2,'inputxoutput'=>'10X20','decibel_loss'=>'-16'],
"2"=>['id'=>3,'inputxoutput'=>'10X20','decibel_loss'=>'-12'],
"3"=>['id'=>4,'inputxoutput'=>'10X20','decibel_loss'=>'-08'],
"4"=>['id'=>5,'inputxoutput'=>'10X30','decibel_loss'=>'-20'],
"5"=>['id'=>6,'inputxoutput'=>'10X30','decibel_loss'=>'-16'],
"6"=>['id'=>7,'inputxoutput'=>'10X30','decibel_loss'=>'-12'],
"7"=>['id'=>8,'inputxoutput'=>'10X30','decibel_loss'=>'-08'],
"8"=>['id'=>9,'inputxoutput'=>'10X40','decibel_loss'=>'-20'],
"9"=>['id'=>10,'inputxoutput'=>'10X40','decibel_loss'=>'-16'],
"10"=>['id'=>11,'inputxoutput'=>'10X40','decibel_loss'=>'-12'],
"11"=>['id'=>12,'inputxoutput'=>'10X40','decibel_loss'=>'-08']
);
foreach($brands AS $brand){
foreach($panel_floors AS $block=>$floors){
$splitter_floors = explode(",", $floors);
$count_floors = count($splitter_floors);
if($count_floors == 5){
// In the example here, if there are 5 panels, it shows how many decibels the product will be searched for which floor.
// The example is not required for the 1st floor in the system here. because on the 3rd floor it will take and finish
$target_products = array("18x-20|13x-16|7x-12|3x-08");
}
for ($vi = 0; $vi < count($target_products); $vi++) {
$floor_tapoff = explode("|", $target_products[$vi]);
$count_product = count($floor_tapoff);
foreach($floor_tapoff AS $floortapoff){
$splitter_floor_tapoff = explode("x", $floortapoff);
$floor = $splitter_floor_tapoff[0]; // Floors 18, 13, 7, 3, 1
$tapoff =$splitter_floor_tapoff[1]; // product to search -20, -16, -12, -08
} // foreach($floor_tapoff AS $floortapoff){
} // for ($vi = 0; $vi < count($target_products); $vi++) {
} // foreach($panel_floors AS $block=>$floors){
} // foreach($brands AS $brand){;
For brand preference selection, I need to print each brand separately.