I have 3 files StartTrack.php
, AustPost.php
and print_order.php
.
StartTrack.php
, AustPost.php
in this both files i have declared Class
and it's object
and in print_order.php
i am just including both files based on condition.
For example (In
print_order.php
) :
I got shipping methods "startrack" And "auspost".
If i found startrack then StartTrack.php
file is include else include AustPost.php
.
So actually i stuck when there multiple orders i got.
For example :: i have total 3 orders, in loop i got there are 2 orders are startrack
and 1 is austpost
so StartTrack.php
will be included 2 times and AustPost.php
file one time but problem is StartTrack.php
is included only once.
Following is my code...
1 ) print_order.php
foreach($ordersinfo['order'] as $orders){
$customerDeliveryMethod = $orders['delivery_method'];
if($customerDeliveryMethod == 'startrack'){
include("StarTrack.php");
}elseif ($customerDeliveryMethod == 'austpost') {
include("AusPost.php");
}
}
2) StartTrack.php
class StarTrack
{
function __construct(argument)
{
echo "StarTrack File Called";
}
}
$StarTrack = new StarTrack;
3) AustPost.php
class AusPost
{
function __construct(argument)
{
echo "AusPost File Called";
}
}
$AusPost = new AusPost;
I could not show my full code because of it's too large in all files i am just adding necessary parts of code in each files.
So my main instance is to find out file will be included multiple times based on shipping methods value.
Startrack have 2 orders to this file will include 2 times not once and Auspost file will include only 1 time because it has only one order.
Please help me how could i resolve this, Is there any class object issue or other?