PHP- Checking for sub-arrays in a multidimensional array - php

I have an array which contains the data to build a nav menu on the site.
This is how it's setup:
$menu = array();
$menu['0']['label'] = 'Home';
$menu['0']['icon'] = 'fa-home';
$menu['0']['id'] = '';
$menu['0']['class'] = '';
$menu['0']['url'] = '/index.php';
$menu['0']['blank'] = 0;
$menu['1']['label'] = 'Admin';
$menu['1']['icon'] = 'fa-user';
$menu['1']['id'] = '';
$menu['1']['class'] = '';
$menu['1']['url'] = '#';
$menu['1']['blank'] = 0;
$menu['1']['0']['label'] = 'Notes';
$menu['1']['0']['icon'] = '';
$menu['1']['0']['id'] = '';
$menu['1']['0']['class'] = '';
$menu['1']['0']['url'] = '/notes.php';
$menu['1']['0']['blank'] = 0;
$menu['1']['1']['label'] = 'Testing';
$menu['1']['1']['icon'] = '';
$menu['1']['1']['id'] = '';
$menu['1']['1']['class'] = '';
$menu['1']['1']['url'] = '/testing.php';
$menu['1']['1']['blank'] = 0;
$menu['2']['label'] = 'Resources';
$menu['2']['icon'] = 'fa-thumb-tack';
$menu['2']['id'] = '';
$menu['2']['class'] = '';
$menu['2']['url'] = '#';
$menu['2']['blank'] = 0;
Where $menu['0'], $menu['1'], etc. are all shown on the main nav menu. Any array underneath them, such as $menu['1']['0'] are all submenus under their parent.
I am trying to check each main element on the array to see if there is a sub-array (if there are any submenus to create).
foreach ($menu as $item) {
if (is_array($item)) {
foreach ($item as $subitem) {
print_r($subitem); // See notes below
}
}
}
What I am trying to do with print_r($subitem) is come up with an array like:
$subitem['label'] = 'Notes';
$subitem['icon'] = '';
$subitem['id'] = '';
$subitem['class'] = '';
$subitem['url'] = '/notes.php';
$subitem['blank'] = 0;
Ideas?

You should reorganize your array:
$menu[0] = ['items' => [], 'submenus' => []];
So all menus have an items key and a submenus key. In the submenus array, you should put an array that looks identical (that is, has and 'items' key and 'submenus' key).
That way you can just count() the submenus key and know if there are any submenus to create. It also will let you nest them as far as you want if you write a recursive function for the menu.
For example:
<?php
// feed this an initialized menu, and an array of items
function addMenuItem($menu, $options) {
$newItem = makeMenu();
$newItem['items'] = $options;
$menu[] = $newItem;
return $menu;
}
// the parent menu is first, submenu second
function addSubMenu($menu, $pos, $subMenu) {
$menu[$pos]['submenus'][] = $subMenu;
return $menu;
}
// create a 'valid' but empty menu array
function makeMenu() {
return array('items' => array(), 'submenus' => array());
}
?>
As a side note, this is something that would work really well in Classes instead of functions and arrays.

I think your current structure may already be very usable. Here is a modified version of your loop using the same data:
foreach ($menu as $parent_item) {
echo '<h2>Parent Items</h2>';
foreach ($parent_item as $key => $item) {
if (is_array($item)) {
echo '<br><h2>Subitems</h2>';
foreach ($item as $subkey => $subitem) {
echo "$subkey = $subitem<br>";
}
} else {
echo "$key = $item<br>";
}
}
echo '<br>';
}
And here is the output:
Parent Itemslabel = Homeicon = fa-homeid = class = url = /index.phpblank = 0Parent Itemslabel = Adminicon = fa-userid = class = url = #blank = 0Subitemslabel = Notesicon = id = class = url = /notes.phpblank = 0Subitemslabel = Testingicon = id = class = url = /testing.phpblank = 0Parent Itemslabel = Resourcesicon = fa-thumb-tackid = class = url = #blank = 0

try this code. It is alot easier to manage.
$menu = array('menu1'=>array(
'label'=>'Home',
'icon'=>'fa-home',
'id'=>'',
'class'=>'',
'url'=>'/index.php',
'blank'=>0),
'menu2'=>array(
'label'=>'Home',
'icon'=>'fa-home',
'id'=>'',
'class'=>'',
'url'=>'/index.php',
'blank'=>0),
'menu3'=>array(
'label'=>'Home',
'icon'=>'fa-home',
'id'=>'',
'class'=>'',
'url'=>'/index.php',
'blank'=>0),
);
//print_r($menu);
Array
(
[menu1] => Array
(
[label] => Home
[icon] => fa-home
[id] =>
[class] =>
[url] => /index.php
[blank] => 0
)
[menu2] => Array
(
[label] => Home
[icon] => fa-home
[id] =>
[class] =>
[url] => /index.php
[blank] => 0
)
[menu3] => Array
(
[label] => Home
[icon] => fa-home
[id] =>
[class] =>
[url] => /index.php
[blank] => 0
)

Consider this structure for your navigation links:
$links = [
'primary_navigation' => [
'children' => [
[
'label' => 'link'
],
[
'label' => 'link',
'children' => [
['label' => 'sublink'],
['label' => 'sublink'],
],
],
],
],
'secondary_navigation' => [
'children' => [
[
'label' => 'link'
],
[
'label' => 'link',
'children' => [
[
'label' => 'sublink'
],
[
'label' => 'sublink',
'children' => [/** ... **/],
],
],
],
],
],
];
This way you always know about your children and its obvious how to find them recursively.

Related

ForEach loop inside associative array PHP

I have following foreach loop
$selectedids = "1255;1256;1257";
$selectedidsarr = explode(';', $selectedids);
$idstand = '1';
foreach ($selectedidsarr as $item) {
$output1 = $idstand++;
echo "<li>product_id_$output1 = $item,</li>";
}
I want to add the output of the above loop inside following associative array
$paramas = array(
'loginId' => $cred1,
'password' => $credpass1,
'orderId' => $orderid,
'offer' => $offerid,
'shipid' => $shipcharge
)
So that the final array will look like this;
$paramas = array(
'loginId' => $cred1,
'password' => $credpass1,
'orderId' => $orderid,
'offer' => $offerid,
'shipid' => $shipcharge,
'product1_id' => 1255,
'product2_id' => 1256,
'product3_id' => 1257,
)
I tried creating following solution but its not working for me
$selectedids = $boughtitem;
$selectedidsarr = explode(';', $selectedids);
$idstand = '1';
foreach ($selectedidsarr as $item) {
$idoutput1 = $idstand++;
$paramas [] = array (
'product$idoutput1_id' => $item,
);
}
Need advice.
You don't need to define a new array, just set the key of the current array to the value you want, in the form of $array[$key] = $value to get an array that looks like [$key=>$value], or in your case...
$paramas['product' . $idoutput1 . '_id'] = $item;

Better way to dynamically access values in nested array

I need a way to dynamically access values in a nested array using an index map. What i want to achieve is looping over an array with data and extract some values that can be in any level of the nesting and save it to a bi-dimensional array.
So far I've come up with the following code, which works quite well, but I was wondering if there is a more efficient way to do this.
<?php
// Sample data
$array = array();
$array[0]['code'] = "ABC123";
$array[0]['ship'] = array("name" => "Fortune", "code" => 'FA');
$array[0]['departure'] = array("port" => "Amsterdam", "code" => "AMS");
$array[0]['document'] = array("type" => "Passport", "data" => array("valid" => '2022-03-18', 'number' => 'AX123456') );
$array[1]['code'] = "QWERT67";
$array[1]['ship'] = array("name" => "Dream", "code" => 'DR');
$array[1]['departure'] = array("port" => "Barcelona", "code" => "BRC");
$array[1]['document'] = array("type" => "Passport", "data" => array("valid" => '2024-12-09', 'number' => 'DF908978') );
// map of indexes of $array I need in my final result array. The levels of the nested indexes is subdivided by ":"
$map = array("code", "ship:name", "departure:port", "document:type", "document:data:number");
$result = array();
// loop array for rows of data
foreach($array as $i => $row){
// loop map for indexes
foreach($map as $index){
// extract specific nested values from $row and save them in 2-dim array $result
$result[$i][$index] = xpath_array($index, $row);
}
}
// print out result
print_r($result);
// takes path to value in $array and returns given value
function xpath_array($xpath, $array){
$tmp = array();
// path is subdivded by ":"
$elems = explode(":", $xpath);
foreach($elems as $i => $elem){
// if first (or ony) iteration take root value from array and put it in $tmp
if($i == 0){
$tmp = $array[$elem];
}else{
// other iterations (if any) dig in deeper into the nested array until last item is reached
$tmp = $tmp[$elem];
}
}
// return found item (can be value or array)
return $tmp;
}
Any suggestion?
This was quite tricky for me, i used Recursive function, first we normalize array keys to obtain key as you want like this document:type, then we normalize array to obtain all at same level :
/**
* #param array $array
* #param string|null $key
*
* #return array
*/
function normalizeKey(array $array, ?string $key = ''): array
{
$result = [];
foreach ($array as $k => $v) {
$index = !empty($key) && !\is_numeric($key) ? $key.':'.$k : $k;
if (true === \is_array($v)) {
$result[$k] = normalizeKey($v, $index);
continue;
}
$result[$index] = $v;
}
return $result;
}
/**
* #param array $item
* #param int $level
*
* #return array
*/
function normalizeStructure(array $item, int $level = 0): array
{
foreach ($item as $k => $v) {
$level = isset($v['code']) ? 0 : $level;
if (true === \is_array($v) && 0 === $level) {
$item[$k] = normalizeStructure($v, ++$level);
continue;
}
if (true === \is_array($v) && 0 < $level) {
$item = \array_merge($item, normalizeStructure($v, ++$level));
unset($item[$k]);
continue;
}
}
return $item;
}
$data = normalizeStructure(normalizeKey($array));
I edited your data set to add more nests:
// Sample data
$array = array();
$array[0]['code'] = "ABC123";
$array[0]['ship'] = array("name" => "Fortune", "code" => 'FA');
$array[0]['departure'] = array("port" => "Amsterdam", "code" => "AMS");
$array[0]['document'] = array("type" => "Passport", "data" => array("valid" => '2022-03-18', 'number' => 'AX123456'));
$array[1]['code'] = "QWERT67";
$array[1]['ship'] = array("name" => "Dream", "code" => 'DR');
$array[1]['departure'] = array("port" => "Barcelona", "code" => "BRC");
$array[1]['document'] = array("type" => "Passport", "data" => array("valid" => '2024-12-09', 'number' => 'DF908978', 'check' => ['number' => '998', 'code' => 'itsWell', 'inception' => ['border' => 'finalInception']]));
With these data, you should finally receive this result:
/*
Array
(
[0] => Array
(
[code] => ABC123
[ship:name] => Fortune
[ship:code] => FA
[departure:port] => Amsterdam
[departure:code] => AMS
[document:type] => Passport
[document:data:valid] => 2022-03-18
[document:data:number] => AX123456
)
[1] => Array
(
[code] => QWERT67
[ship:name] => Dream
[ship:code] => DR
[departure:port] => Barcelona
[departure:code] => BRC
[document:type] => Passport
[document:data:valid] => 2024-12-09
[document:data:number] => DF908978
[document:data:check:number] => 998
[document:data:check:code] => itsWell
[document:data:check:inception:border] => finalInception
)
)
*/
Recursivity seems to be like Inception, everything is nested and you can lose your mind in 😆, mine was already lost in.

PHP Reverse Category Tree array to Breadcrumb List

I have a category tree array fetched from MySQL Table. I want to revert this Category array tree back into Breadcrumb list using PHP.
PHP Category Tree Building Function
function buildTree(array &$elements, $parentId = 0)
{
$branch = array();
foreach ($elements as $element) {
if ($element['parent_category_id'] == $parentId) {
$children = buildTree($elements, $element['category_id']);
if ($children) {
$element['children'] = $children;
}
$branch[$element['category_id']] = $element;
unset($elements[$element['category_id']]);
}
}
return $branch;
}
Result Array
[48] => Array
(
[category_id] => 48
[category_name] => Cat 1
[parent_category_id] => 0
[children] => Array
(
[957] => Array
(
[category_id] => 957
[category_name] => Cat 2
[parent_category_id] => 48
[children] => Array
(
[1528] => Array
(
[category_id] => 1528
[category_name] => Cat 3
[parent_category_id] => 957
)
[1890] => Array
(
[category_id] => 1890
[category_name] => Cat 4
[parent_category_id] => 957
)
[1570] => Array
(
[category_id] => 1570
[category_name] => Cat 5
[parent_category_id] => 957
)
[958] => Array
(
[category_id] => 958
[category_name] => Cat 6
[parent_category_id] => 957
)
)
)
Now I want to convert this array tree back into Breadcrumb List using PHP, for example
"Cat 1 > Cat 2 > Cat 3"
"Cat 1 > Cat 2 > Cat 4"
"Cat 1 > Cat 2 > Cat 5"
"Cat 1 > Cat 2 > Cat 6"
Any help would be much appreciated.
Screenshot
Screenshot Reference
The key concept is converting your tree into a flat array where each category is indexed by it's ID. From that flat structure, you can walk up the hierarchy until you reach the root for each category, creating an array of the levels. I've created a helper class to encapsulate the basic functionality you might want for breadcrumbs. The recursion happens in the _unwindTree method. The _buildBreadcrumbs method calls this function and uses the resulting flat array to build the breadcrumb "lines" for each category. These are the two functions to look at to understand how you convert a tree into an array of category paths.
There are some public functions that provide access to the breadcrumb data in different ways.
<?php
$tree = [
48 => [
'category_id' => 48,
'category_name' => 'Cat 1',
'parent_category_id' => 0,
'children' =>
[
957 =>
[
'category_id' => 957,
'category_name' => 'Cat 2',
'parent_category_id' => 48,
'children' =>
[
1528 =>
[
'category_id' => 1528,
'category_name' => 'Cat 3',
'parent_category_id' => 957
],
1890 =>
[
'category_id' => 1890,
'category_name' => 'Cat 4',
'parent_category_id' => 957
],
1570 =>
[
'category_id' => 1570,
'category_name' => 'Cat 5',
'parent_category_id' => 957
],
958 =>
[
'category_id' => 958,
'category_name' => 'Cat 6',
'parent_category_id' => 957
]
]
]
]
]
];
class BreadcrumbHelper
{
private $_leafOnly = true;
private $_defaultBaseUrlPath = '/category/';
private $_tree = [];
private $_idMap = [];
private $_leafIds = [];
private $_breadcrumbs = [];
/**
* BreadcrumbHelper constructor.
* #param array $tree The tree of category data
*/
public function __construct($tree)
{
$this->_tree = $tree;
//Build the breadcrumb data structure
$this->_buildBreadcrumbs();
}
/**
* Return breadcrumbs as an array
* #param mixed $categoryIds optional, only specified categories will be returned
* #return array
*/
public function getBreadcrumbArray($categoryIds = [])
{
//If a bare ID is passed, wrap it in an array so we can treat all input the same way
if (!is_array($categoryIds))
{
$categoryIds = [$categoryIds];
}
//If we have category input, return a filtered array of the breadcrumbs
if (!empty($categoryIds))
{
return array_intersect_key($this->_breadcrumbs, array_flip($categoryIds));
}
//If no input, return the fill array
return $this->_breadcrumbs;
}
/**
* Return breadcrumbs as an array containing HTML markup
* You may want to modify this to echo HTML directly, or return markup only instead of an array
* #param mixed $categoryIds optional, only specified categories will be returned
* #return array
*/
public function getBreadcrumbHtml($categoryIds = [], $baseUrlPath = null)
{
//If a bare ID is passed, wrap it in an array so we can treat all input the same way
if (!is_array($categoryIds))
{
$categoryIds = [$categoryIds];
}
//If a base URL path is provided, use it, otherwise use default
$baseUrlPath = (empty($baseUrlPath)) ? $this->_defaultBaseUrlPath : $baseUrlPath;
//Filter breadcrumbs if IDs provided
$breadcrumbs = (empty($categoryIds)) ? $this->_breadcrumbs : array_intersect_key($this->_breadcrumbs, array_flip($categoryIds));
$output = [];
foreach ($breadcrumbs as $currCategoryId => $currLine)
{
$currLinkBuffer = [];
foreach ($currLine as $currCategory)
{
//Build the markup - customize the URL for your application
$currLinkBuffer[] = '' . $currCategory['category_name'] . '';
}
$output[$currCategoryId] = implode(' > ', $currLinkBuffer);
}
return $output;
}
/**
* Print the breadcrumbs
* #param array $categoryIds optional, only specified categories will be printed
*/
public function printBreadcrumbs($categoryIds = [])
{
//If a bare ID is passed, wrap it in an array so we can treat all input the same way
if (!is_array($categoryIds))
{
$categoryIds = [$categoryIds];
}
//Filter breadcrumbs if IDs provided
$breadcrumbs = (empty($categoryIds)) ? $this->_breadcrumbs : array_intersect_key($this->_breadcrumbs, array_flip($categoryIds));
foreach ($breadcrumbs as $currLine)
{
//Build a buffer of the category names
$currNameBuffer = [];
foreach ($currLine as $currCategory)
{
$currNameBuffer[] = $currCategory['category_name'];
}
//Join the name buffer with a separator and echo the result
echo implode(' > ', $currNameBuffer) . PHP_EOL;
}
}
/**
* Create the breadcrumb data structure from the provided tree
*/
private function _buildBreadcrumbs()
{
//Unwind the tree into a flat array
$this->_unwindTree($this->_tree);
//Traverse the flat array and build the breadcrumb lines
$categoryIds = ($this->_leafOnly) ? $this->_leafIds:array_keys($this->_idMap);
foreach ($categoryIds as $currLeafId)
{
$currCategoryId = $currLeafId;
$currLine = [];
do
{
$currLine[] = $this->_idMap[$currCategoryId];
$currCategoryId = $this->_idMap[$currCategoryId]['parent_category_id'];
} while ($currCategoryId != 0);
$this->_breadcrumbs[$currLeafId] = array_reverse($currLine);
}
}
/**
* Recursive function that traverses the tree and builds an associative array of all categories
* indexed by ID. Categories saved in this structure do not include children.
* #param $branch
*/
private function _unwindTree($branch)
{
foreach ($branch as $currId => $currData)
{
//Set the current category in the ID map, remove the children if present
$this->_idMap[$currId] = array_diff_key($currData, array_flip(['children']));
if (!empty($currData['children']))
{
//Recursion
$this->_unwindTree($currData['children']);
}
else
{
$this->_leafIds[] = $currId;
}
}
}
}
//Instantiate our helper with the tree data
$breadcrumbHelper = new BreadcrumbHelper($tree);
echo 'All breadcrumbs: ' . PHP_EOL;
$breadcrumbHelper->printBreadcrumbs();
echo PHP_EOL;
echo 'Single breadcrumb line by category ID: ' . PHP_EOL;
$breadcrumbHelper->printBreadcrumbs(1570);
echo PHP_EOL;
echo 'Multiple categories: ' . PHP_EOL;
$breadcrumbHelper->printBreadcrumbs([957, 1570]);
echo PHP_EOL;
echo 'Breadcrumb HTML: ' . PHP_EOL;
$breadcrumbMarkup = $breadcrumbHelper->getBreadcrumbHtml();
echo $breadcrumbMarkup[1570] . PHP_EOL;
echo PHP_EOL;
echo 'Breadcrumb HTML with custom base URL: ' . PHP_EOL;
$breadcrumbMarkup = $breadcrumbHelper->getBreadcrumbHtml(1570, '/category.php?id=');
echo $breadcrumbMarkup[1570] . PHP_EOL;
echo PHP_EOL;
function treeToArray($data, &$return_data, $index = '', $sub = 'sub')
{
if (is_array($data)) {
foreach ($data as $value) {
if (isset($value[$sub])) {
$tmp = $value[$sub];
unset($value[$sub]);
if ($index) {
$return_data[$value[$index]] = $value;
} else {
$return_data[] = $value;
}
treeToArray($tmp, $return_data, $index, $sub);
} else {
if ($index) {
$return_data[$value[$index]] = $value;
} else {
$return_data[] = $value;
}
}
}
}
return $return_data;
}
$tree[48] = Array
(
"category_id" => '48',
"category_name" => 'Cat 1',
"parent_category_id" => '0',
"children" => Array
(
'957' => Array
(
"category_id" => "957",
"category_name" => "Cat",
"parent_category_id" => "48",
"children" => Array
(
'1528' => Array
(
"category_id" => "1528",
"category_name" => "Cat3",
"parent_category_id" => "957",
)
)
)
)
);
$data = [];
treeToArray($tree, $data, 'category_id', 'children');
print_r($data);
hope it can be helpful

how to display dynamic array values to view from model in codeigniter

here is my model code:
foreach ($query->result() as $row)
{
$data = array(
'ptitle' =>$row->ptitle,
'technology' => $row->technology,
'description' => $row->description,
);
$this->session->set_userdata('project',$data);
}
here is my View code:
<?php
if (isset($this->session->userdata['project']))
{
$ptitle = ($this->session->userdata['project']['ptitle']);
$technology = ($this->session->userdata['project']['technology']);
$description = ($this->session->userdata['project']['description']);
}
?>
when i print array it displays
Array ( [ptitle] => opmp [technology] => hbh [description] => kg ) Array ( [ptitle] => icicse [technology] => vv [description] => bhjv ) .can someone help me to print this values in view
Setting session should be like this
$data = array(
'ptitle' => $row['ptitle'],
'technology' => $row['technology'],
'description' => $row['description'],
);
$this->session->set_userdata($data);
To retrive them use
if (isset($this->session->userdata['project']))
{
$ptitle = $this->session->userdata('ptitle');
$technology = $this->session->userdata('technology');
$description = $this->session->userdata('description');
}
If your are storing multiple as array in SESSION then you surely need foreach in your view too.
Change from
if(isset($this->session->userdata['project']))
{
$ptitle = ($this->session->userdata['project']['ptitle']);
$technology = ($this->session->userdata['project']['technology']);
$description = ($this->session->userdata['project']['description']);
}
into
if(isset($this->session->userdata['project']))
{
foreach($this->session->userdata['project'] as $project)
{
$ptitle = $project['ptitle'];
$technology = $project['technology'];
$description = $project['description'];
echo $ptitle.'<br>'.$technology.'<br>'.$description.'<br>';
}
}
Try setting your array like bellow and then pass it to session set data.
$project = array("project" =>
array(
'ptitle' => "ptitle",
'technology' => "technology",
'description' => "description",
)
);
$this->session->set_userdata($project);

How to dynamicly get a multi dimensional array?

My code just populates the last array in the array $workshops
my loop function populates array $workshops, like so
while (ECSE_purchase::have_products()) {
ECSE_purchase::the_product();
$prodid = ECSE_purchase_product::get_the_ID();
$workshop_data = ETICKETDATA::get_workshop_details_helper($prodid);
$workshops = array();
if($prodid == 565) {
............
} else {
$workshopsTmp = array();
$workshopsTmp['workshop_barcode'] = $data['workshop_barcode'];
$workshopsTmp['workshop_id'] = ECSE_purchase_product::get_the_ID();
$workshopsTmp['workshop_title'] = ECSE_purchase_product::get_the_name();
$workshopsTmp['workshop_time'] = $workshop_data['time'];
$workshopsTmp['workshop_room'] = $workshop_data['room'];
$workshopsTmp['workshop_num_of_tickets'] = ECSE_purchase_product::get_the_QTY();
$workshops[] = $workshopsTmp;
}
But here i just get the last array and not like this:
$workshops = array(array('workshop_barcode' => '0101010101',
'workshop_id' => '589',
'workshop_title' => 'Swimming',
'workshop_time' => '12:00',
'workshop_room' => 'Room 1',
'workshop_num_of_tickets' => '2'),
array('workshop_barcode' => '03030303003',
'workshop_id' => '568',
'workshop_title' => 'Running',
'workshop_time' => '15:00',
'workshop_room' => 'Room 3',
'workshop_num_of_tickets' => '3'),
array('workshop_barcode' => '0505050505',
'workshop_id' => '570',
'workshop_title' => 'Biking',
'workshop_time' => '16:00',
'workshop_room' => 'Room 2',
'workshop_num_of_tickets' => '2'));
Any pointers appreciated.
regards,
just edit the loop
You keep redefining your initial array. Try putting $workshops array before while loop
$workshops = array();
while (ECSE_purchase::have_products()) {
ECSE_purchase::the_product();
$prodid = ECSE_purchase_product::get_the_ID();
$workshop_data = ETICKETDATA::get_workshop_details_helper($prodid);
if($prodid == 565) {
............
} else {
$workshopsTmp = array();
$workshopsTmp['workshop_barcode'] = $data['workshop_barcode'];
$workshopsTmp['workshop_id'] = ECSE_purchase_product::get_the_ID();
$workshopsTmp['workshop_title'] = ECSE_purchase_product::get_the_name();
$workshopsTmp['workshop_time'] = $workshop_data['time'];
$workshopsTmp['workshop_room'] = $workshop_data['room'];
$workshopsTmp['workshop_num_of_tickets'] = ECSE_purchase_product::get_the_QTY();
$workshops[] = $workshopsTmp;
}

Categories