How to Add rating to space

I am trying to see how to add rating to space. I try searching for it but didn't see it ? I see it on market on una.io

Please see picture below for example.

  • 838
  • More
Attachments
Replies (9)
    • I wanted to add it to blogs but couldnt...would love info if possible.

      • Hello all!

        It will require connecting the voting system. For the Market app, it looks like the following set of MySQL commands in the install/sql/install.sql file:

        INSERT INTO `sys_objects_vote` (`Name`, `Module`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 

        ('bx_market', 'bx_market', 'bx_market_votes', 'bx_market_votes_track', '604800', '1', '5', '0', '1', 'bx_market_products', 'id', 'author', 'rate', 'votes', 'BxMarketVoteStars', 'modules/boonex/market/classes/BxMarketVoteStars.php');

        The main `bx_market_products` table has the `rate`, `votes`, and `allow_vote_to` fields to operate with that data.

        The vote action will require the menu, which looks like:

        INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `submenu_popup`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `order`) VALUES 

        ('bx_market_view_actions', 'bx_market', 'vote', '_sys_menu_item_title_system_va_vote', '', '', '', '', '', '', '', 0, 2147483647, '', 0, 0, 220);

        in the install/sql/enable.sql file of the same module.

        And the necessary privacy commands to work with the voting:

        INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `spaces`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES

        ('bx_market_allow_vote_to', 'bx_market', 'vote', '_bx_market_form_entry_input_allow_vote_to', 'c', '', 'bx_market_products', 'id', 'author', 'BxMarketPrivacy', 'modules/boonex/market/classes/BxMarketPrivacy.php');

        Finally, the block with the rating is created by this command:

        INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES

        ('bx_market_view_entry', 3, 'bx_market', '', '_bx_market_page_block_title_entry_rating', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_market";s:6:"method";s:13:"entity_rating";}', 0, 0, 1, 4);

        So the work is the standard, but not so small...

        • Thank for the information, so I can replace the market name with the model I would like it to use? Or it as the run through the market module for the rating to work. I was trying to install the market module and find that rating block in the dev mod , and copy the code inside that block, and add it in the space view page. but when try to link it wasn't showing on the page. This is before you provided that code.

          • Hi @LeonidS ... i lost you right after hello all....😁

              • Hello @lejt !

                Yes, in the provided code you may replace the bx_market word with the actual module name.

                • 😂🤗

                  • Do the market module need to be installed for the code to work

                    • No, it was just example about the voting system integration.

                      Login or Join to comment.