Tags ID are incremented each time a product is modified



  • Hello,

    Each time a product is edited and saved, Tags ID are changing.

    It make non sense to me as i need to add a field/property (‘category’) to the Tag Object

    When my field is added and his value is modified for example :
    Tag->name = 'economy’
    Tag->category = ‘Article’

    When i edit my product Tag->category is lost.
    When go to catalog>Tags econmy’id value is no more ‘1’ but Two.

    I see in adminProductController that Tags are deleted then reassign.

    So all previous modification to Object tag are lost and the ID has been incremented.
    The Method addTags never recognize is_obect_loaded.

    Is it normal ? why ?


  • Global Moderator

    People usually write code which fits their needs. They have no magic crystal ball to find out which other uses one could come up with in the future. The code in question was written in 7/2015 (reformatted later).

    Now it’s 2017 and you found such an additional use, so this code apparently needs a review. If you can come up with better code, not breaking previous usage, I’m pretty sure it can be accepted for thirty bees 1.1.0.



  • At first, thanks for your reply,

    I’ve found another solution and now i use features.

    For Tags I’ve found another logic to develop the solution
    When deleteTags is called create as, $tag_removed and a $tag_category_removed push in an array as param to addTags() which call the constructor with an array as param for $name then call __construct::ObjectModel

    This is what i imagined to keep all the maximum native code. but iswitch for features

    But i don’t understand the logic to deleted and recreated. the reason why.
    I see in adminProductController, that i would have to force the association of tag to product in product_tag BEFORE but something get me wrong.


  • Global Moderator

    But i don’t understand the logic to deleted and recreated. the reason why.

    It’s the simplest way to do an update. Such updates happen rarely, so there’s no need for performance optimization.

    For Tags I’ve found another logic to develop the solution

    Code, please! :relaxed: Ideally as a pull request, but patches uploaded here are also welcome.


Log in to reply
 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.