Totally Zenned
- Join Date:
- May 2006
- Location:
- Gardiner, Maine
- Posts:
- 2,383
- Plugin Contributions:
- 7
Porting OsC mod
Getting a little deep in this mod for a client who simply wants her old inventory update mod.
Easy enough to change tep to zen and to put in replace if bits but I have foreach situation and I need help resolving this. This is the section I'm converting. I know the foreach line does not work due to the array_keys
$categories = array();
// Consolidate the below into a join, so we can alphabetise, among other things.
$categories = $db->Execute("SELECT c.categories_id, c.parent_id, cd.categories_name FROM categories AS c, categories_description AS cd WHERE c.parent_id > 0 AND cd.categories_id = c.categories_id ORDER BY cd.categories_name ASC");
// Buffer the categories.
while($categories->EOF) {
$categories[] = array('id' => $category['categories_id'],
'parent_id' => $category['parent_id'],
'name' => $category['categories_name']);
$categories->MoveNext();
}
echo zen_draw_form('products_update', 'riu.php', 'action=process');
foreach(array_keys($categories) as $category) {
$categories_products_query = $db->Execute("SELECT products_id FROM products_to_categories WHERE categories_id = " . $categories[$category]['id']);
if($categories_products_query->RecordCount()) {
The error message is array_keys() expects parameter 1 to be array, object given in...
I've seen some examples of how to change this but just not sure and what I've tried hasn't worked. Could be due to how the section is set up before we get that far - I just don't know.
Would someone check the php for this to push me in the right direction? Any help would be appreciated.