HI,
I am trying to build a product ordering form. Users can order simple products (no payment). I use HikaShop to manage the products but I need to use Chronoforms for the ordering since I need a lot more information from the user regarding the order.
I need to separate out the products into product categories into different sections/tabs and am using the Tab feature in Chronoforms to do this. In each tab I need a table layout that displays the image, product name, product description, product code, max order amount and a field for quantity.
I setup a DB Read in Setup to call in the products. I then created a relation with the category table to grab the category for each product.
In the tab I have a custom code element that has the following code:
my debug array looks like the following:
My issue is obvious. I get no results even through the array is there. How do I join the the "prod" and "cat" arrays and how do I get my data to display in a table format.
Thank you in advance.
Becky
I am trying to build a product ordering form. Users can order simple products (no payment). I use HikaShop to manage the products but I need to use Chronoforms for the ordering since I need a lot more information from the user regarding the order.
I need to separate out the products into product categories into different sections/tabs and am using the Tab feature in Chronoforms to do this. In each tab I need a table layout that displays the image, product name, product description, product code, max order amount and a field for quantity.
I setup a DB Read in Setup to call in the products. I then created a relation with the category table to grab the category for each product.
In the tab I have a custom code element that has the following code:
$result = $form->data;
foreach($result as $key => $subarray) {
foreach($subarray as $subkey => $subsubarray) { // gets to prod
$p = $result[$key][$subkey];
$pc = $p['product_code'];
$code = str_replace('.', '_', $pc);
echo "<tr>
<td class='small-product-image'>
<img src='/images/com_hikashop/upload/thumbnails/100x100f/$code.jpg' class='prodimg' alt='$code' /></td>
<td>{$p['product_name']}</td>
<td>{$p['product_code']}</td>
<td><input type='text' name='quantity[{$p['product_id']}]' id='quantity_{$p['product_id']} size='4' /></td>
<td>{$p['category_id']}</td>
</tr>";
}
}
my debug array looks like the following:
Array
(
[chronoform] => PromoItems
[event] => Page2
[repname] => MARY SMITH
[repemail] => marys@anemail.com
[repphone] => 555-555-5555
[repmanager] => Becky
[repmanageremail] => becky@anemail.com
[eventname] => test
[eventdate] => 12-01-2015
[requestpurpose] => trade-show
[exceptiondetails] =>
[btn_page1] => Next
[0] => Array
(
[prod] => Array
(
[product_id] => 2
[product_name] => Black Cloth Bag
[product_description] =>
[product_code] => 850.00002.2
[product_published] => 1
[product_max_per_order] => 10
)
[cat] => Array
(
[category_id] => 12
[product_id] => 2
)
)
[1] => Array
(
[prod] => Array
(
[product_id] => 3
[product_name] => Dog Poop Bag
[product_description] =>
[product_code] => 850.00004.2
[product_published] => 1
[product_max_per_order] => 100
)
[cat] => Array
(
[category_id] => 12
[product_id] => 3
)
)
My issue is obvious. I get no results even through the array is there. How do I join the the "prod" and "cat" arrays and how do I get my data to display in a table format.
Thank you in advance.
Becky