[Resolved] Include ID into category list


  • Default avatar
    alain49    
     12 years ago
    0

    Hi,
    When I want to select one or more category(ies) into virtuemart to make a coupon, Awocoupon pro display all the categories in alphabetical order...

    The issue :
    When you have virtuemart organized like that :

    music
    -- book
    -- CD
    -- DVD
    -- accessories

    garden
    -- book
    -- CD
    -- DVD
    -- accessories

    motorcycle
    -- book
    -- CD
    -- DVD
    -- accessories

    When you ask AWO to display all categories, you can see :
    accessories
    accessories
    accessories
    book
    book
    book
    CD
    CD
    CD
    DVD
    DVD
    DVD
    garden
    motorcycle
    music

    hum... Hard to pick the right item.... No ?
    You have to select all items. They appear in a box below with their ID. You have to consult your own listing to know what is DVD ID9 i.e. and remove all others...

    A simple solution would be to add one more field iin the database request for the listing : ID. Not only the name of the categories. And then display these categories not in alphabetical order, but by ID...

    One of my client have such an organisation for Virtuemart shop. And, this morning, I notice he had more than 20 categories called "CD Conférence"... But he wanted to make a discount to only one and had no possibility to know what item he had to pick...

    Regards. Alain
  • Your avatar
    seyi    
     12 years ago
    0

    This function existed in 1.4.8, but got lost when upgrading the interface. Here is the fix:
    in www/administrator/components/com_awocoupon/controller.php, around line 1211 is this:
    <?php
    if(!empty($sql)) {
        
    $db->setQuery($sql);
        foreach(
    $db->loadObjectList() as $rowarray_push($result, array("id"=>$row->id"label"=>$row->label"value" => strip_tags($row->label)));
    }
    ?>


    Change it to this
    <?php
    if($type=='category') {
        
    $rtn awoLibrary::categoryListTree();
        foreach(
    $rtn as $rowarray_push($result, array("id"=>$row->category_id"label"=>$row->dd_name"value" => strip_tags($row->category_name)));
    }
    elseif(!empty(
    $sql)) {
        
    $db->setQuery($sql);
        foreach(
    $db->loadObjectList() as $rowarray_push($result, array("id"=>$row->id"label"=>$row->label"value" => strip_tags($row->label)));
    }
    ?>


    This will also be updated within the code for future versions
  • Default avatar
    alain49    
     12 years ago
    0

    Thank for the hack. I'm going to modify the code.
    Regards.
    And thank you for the support.