Page 1 of 1

Set category on admin/product

Posted: Wed Sep 22, 2021 10:56 pm
by LeeFoster
A while back I remember having an addon that allowed to me to specify what category a product would appear in from the product within admin. It was on an older osCommerce site, can anyone remember what it is/was called?

Re: Set category on admin/product

Posted: Wed Sep 22, 2021 11:36 pm
by LeeFoster
wHiTeHaT44 wrote: Wed Sep 22, 2021 11:28 pm Here you go.........
(link removed by Admin)
Thanks though I'm not sure that is it. I was pretty sure it was a later version than that.

Re: Set category on admin/product

Posted: Thu Sep 23, 2021 6:25 am
by Kofod95
The product manager allows that as far as I understand.

It wouldn't be too bad to write something to do that for Phoenix, if you prefer DIY - one hook-file should be enough

//Daniel

Re: Set category on admin/product

Posted: Thu Sep 23, 2021 7:02 am
by LeeFoster
Kofod95 wrote: Thu Sep 23, 2021 6:25 am The product manager allows that as far as I understand.

It wouldn't be too bad to write something to do that for Phoenix, if you prefer DIY - one hook-file should be enough

//Daniel
I think that might be overkill for what I need. I'll have a proper look though.

Might go down the DIY, will check all my options first.

Re: Set category on admin/product

Posted: Thu Sep 23, 2021 8:48 pm
by Kofod95
LeeFoster wrote: Thu Sep 23, 2021 7:02 am I think that [the product manager] might be overkill for what I need.
It does do a lot of stuff, so it might be like shooting sparrows with canons (that expression exist in Denmark, and hopefully it makes sense for others as well).
LeeFoster wrote: Thu Sep 23, 2021 7:02 am Might go down the DIY, will check all my options first.
Sure - if you decide to DIY, you can look at how the specials are added to the product_edit and change to fit your needs - I will gladly try to help with that, should it be necessary

//Daniel

Re: Set category on admin/product

Posted: Fri Sep 24, 2021 6:44 am
by LeeFoster
Kofod95 wrote: Thu Sep 23, 2021 8:48 pm Sure - if you decide to DIY, you can look at how the specials are added too the product_edit and change to fit your needs - I will gladly try to help with that, should it be necessary

//Daniel
Downloading this now to have a look to see if I can modify it to work.

Re: Set category on admin/product

Posted: Thu Sep 30, 2021 10:01 am
by LeeFoster
OK I mostly got something working, the issue I'm now having is I'd like it to show the whole category tree, not just a list of categories as I have in the image below.
Capture3.PNG
This is the code being used to create the list.

Code: Select all

$categories_query = tep_db_query("select categories_id, categories_name FROM categories_description where language_id = '" . (int)$languages_id . "' order by categories_name");
    
    while ($categories = tep_db_fetch_array($categories_query)) {
      $checked = $this->category_checked($pID, $categories['categories_id']);
      
      //$categories_checkbox .= tep_draw_checkbox_field('categories[]', $categories['categories_id'], $checked) . ' - ' . $categories['categories_name'] . '<br />';
      
      
      $categories_checkbox .= '<div class="custom-control custom-switch">';
        $categories_checkbox .= tep_draw_selection_field('categories[]', 'checkbox', $categories['categories_id'], $checked, 'class="custom-control-input" id="c_' . $categories['categories_id'] . '"');
        $categories_checkbox .= '<label for="c_' . $categories['categories_id'] . '" class="custom-control-label text-muted"><small>' . $categories['categories_name'] . '</small></label>';
      $categories_checkbox .= '</div>';