pdoPage и Tickets

Добрый вечер! Использую на своем новостном сайте компонент Tickets и мне на главной нужно вывести три последних записи из определенной категории. Для этого вывожу все это сниппетом pdoPage, только без навигации по страницам (хотя, может есть другие способы вывода Tickets, я брал из документации)
[[pdoPage?
&element=`getTickets`
&action=`tickets`
&parents=`15`
&limit=`3`
&tpl=`homeArtTpls`
&includeTVs=`img`
]]
На превьюшках вывожу количество просмотров и комментариев
[[!TicketMeta? &tpl=`@INLINE [[+views]]`]]
[[!TicketMeta? &tpl=`@INLINE [[+comments]]`]]
Из-за того что сниппет вызывается кэшированным, кол-во просмотров и комментариев выводятся неактуальными.

Когда вызываю сниппет некэшированным, у меня вместо трех новостей выводится только одна. Почему не могу понять. В журнале ошибок по этому поводу ничего нет.

Может кто-нибудь укажет на мою ошибку?
Константин
15 апреля 2018, 17:56
modx.pro
2 101
0

Комментарии: 10

Андрей
15 апреля 2018, 22:00
+1
Из документации:

Выводит список созданных тикетов. *Сниппет вызывается не кэшированным.

pdoPage здесь также не нужен, должно работать так:

[[!getTickets?
	&parents=`15`
	&limit=`3`
	&tpl=`homeArtTpls`
	&includeTVs=`img`
]]

p.s. Если всё ещё будет показывать вместо трёх одну новость, включить параметр showLog и посмотреть что там вообще в выборку попадает.
    Константин
    15 апреля 2018, 22:15
    0
    Все равно выводится одна новость.
    showLog
    0.0143850: pdoTools loaded
    0.0112228: Returning processed chunks
    0.3389301: Total time
    8 912 896: Memory usage

    Если указать в сниппете пустой &tpl=``, то видно, что выводится ТРИ массива со всеми заголовками, ссылками на изображения, просмотры и т.д.

    showLog при пустом &tpl
    0.0001550: Query parameters are prepared.
    0.0001340: xPDO query object created
    0.0004339: Included list of tvs: img
    0.0001600: leftJoined TicketsSection as Section
    0.0001230: leftJoined modUser as User
    0.0001180: leftJoined modUserProfile as Profile
    0.0001669: leftJoined TicketTotal as Total
    0.0001180: leftJoined modTemplateVarResource as TVimg
    0.0000031: Grouped by Ticket.id
    0.0001011: Added selection of TicketsSection: `id` AS `section.id`, `type` AS `section.type`, `contentType` AS `section.contentType`, `pagetitle` AS `section.pagetitle`, `longtitle` AS `section.longtitle`, `description` AS `section.description`, `alias` AS `section.alias`, `link_attributes` AS `section.link_attributes`, `published` AS `section.published`, `pub_date` AS `section.pub_date`, `unpub_date` AS `section.unpub_date`, `parent` AS `section.parent`, `isfolder` AS `section.isfolder`, `introtext` AS `section.introtext`, `richtext` AS `section.richtext`, `template` AS `section.template`, `menuindex` AS `section.menuindex`, `searchable` AS `section.searchable`, `cacheable` AS `section.cacheable`, `createdby` AS `section.createdby`, `createdon` AS `section.createdon`, `editedby` AS `section.editedby`, `editedon` AS `section.editedon`, `deleted` AS `section.deleted`, `deletedon` AS `section.deletedon`, `deletedby` AS `section.deletedby`, `publishedon` AS `section.publishedon`, `publishedby` AS `section.publishedby`, `menutitle` AS `section.menutitle`, `donthit` AS `section.donthit`, `privateweb` AS `section.privateweb`, `privatemgr` AS `section.privatemgr`, `content_dispo` AS `section.content_dispo`, `hidemenu` AS `section.hidemenu`, `class_key` AS `section.class_key`, `context_key` AS `section.context_key`, `content_type` AS `section.content_type`, `uri` AS `section.uri`, `uri_override` AS `section.uri_override`, `hide_children_in_tree` AS `section.hide_children_in_tree`, `show_in_tree` AS `section.show_in_tree`, `properties` AS `section.properties`
    0.0000129: Added selection of modUser: `username`
    0.0000298: Added selection of modUserProfile: `internalKey`, `fullname`, `email`, `phone`, `mobilephone`, `blocked`, `blockeduntil`, `blockedafter`, `logincount`, `lastlogin`, `thislogin`, `failedlogincount`, `sessionid`, `dob`, `gender`, `address`, `country`, `city`, `state`, `zip`, `fax`, `photo`, `comment`, `website`, `extended`
    0.0000410: Added selection of Ticket: `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`
    0.0000851: Added selection of TicketTotal: `comments`, `views`, `stars`, `rating`, `rating_plus`, `rating_minus`
    0.0000131: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `img`
    0.0000210: Replaced TV conditions
    0.0004129: Processed additional conditions
    0.0006239: Added where condition: class_key=Ticket, Ticket.parent:IN(15,39,40,41), Ticket.published=1, Ticket.deleted=0
    0.0000072: Replaced TV conditions
    0.0000641: Sorted by Ticket.createdon, DESC
    0.0000019: Limited to 3, offset 0
    0.0003800: SQL prepared "SELECT `Section`.`id` AS `section.id`, `Section`.`type` AS `section.type`, `Section`.`contentType` AS `section.contentType`, `Section`.`pagetitle` AS `section.pagetitle`, `Section`.`longtitle` AS `section.longtitle`, `Section`.`description` AS `section.description`, `Section`.`alias` AS `section.alias`, `Section`.`link_attributes` AS `section.link_attributes`, `Section`.`published` AS `section.published`, `Section`.`pub_date` AS `section.pub_date`, `Section`.`unpub_date` AS `section.unpub_date`, `Section`.`parent` AS `section.parent`, `Section`.`isfolder` AS `section.isfolder`, `Section`.`introtext` AS `section.introtext`, `Section`.`richtext` AS `section.richtext`, `Section`.`template` AS `section.template`, `Section`.`menuindex` AS `section.menuindex`, `Section`.`searchable` AS `section.searchable`, `Section`.`cacheable` AS `section.cacheable`, `Section`.`createdby` AS `section.createdby`, `Section`.`createdon` AS `section.createdon`, `Section`.`editedby` AS `section.editedby`, `Section`.`editedon` AS `section.editedon`, `Section`.`deleted` AS `section.deleted`, `Section`.`deletedon` AS `section.deletedon`, `Section`.`deletedby` AS `section.deletedby`, `Section`.`publishedon` AS `section.publishedon`, `Section`.`publishedby` AS `section.publishedby`, `Section`.`menutitle` AS `section.menutitle`, `Section`.`donthit` AS `section.donthit`, `Section`.`privateweb` AS `section.privateweb`, `Section`.`privatemgr` AS `section.privatemgr`, `Section`.`content_dispo` AS `section.content_dispo`, `Section`.`hidemenu` AS `section.hidemenu`, `Section`.`class_key` AS `section.class_key`, `Section`.`context_key` AS `section.context_key`, `Section`.`content_type` AS `section.content_type`, `Section`.`uri` AS `section.uri`, `Section`.`uri_override` AS `section.uri_override`, `Section`.`hide_children_in_tree` AS `section.hide_children_in_tree`, `Section`.`show_in_tree` AS `section.show_in_tree`, `Section`.`properties` AS `section.properties`, `User`.`username`, `Profile`.`internalKey`, `Profile`.`fullname`, `Profile`.`email`, `Profile`.`phone`, `Profile`.`mobilephone`, `Profile`.`blocked`, `Profile`.`blockeduntil`, `Profile`.`blockedafter`, `Profile`.`logincount`, `Profile`.`lastlogin`, `Profile`.`thislogin`, `Profile`.`failedlogincount`, `Profile`.`sessionid`, `Profile`.`dob`, `Profile`.`gender`, `Profile`.`address`, `Profile`.`country`, `Profile`.`city`, `Profile`.`state`, `Profile`.`zip`, `Profile`.`fax`, `Profile`.`photo`, `Profile`.`comment`, `Profile`.`website`, `Profile`.`extended`, `Ticket`.`id`, `Ticket`.`type`, `Ticket`.`contentType`, `Ticket`.`pagetitle`, `Ticket`.`longtitle`, `Ticket`.`description`, `Ticket`.`alias`, `Ticket`.`link_attributes`, `Ticket`.`published`, `Ticket`.`pub_date`, `Ticket`.`unpub_date`, `Ticket`.`parent`, `Ticket`.`isfolder`, `Ticket`.`introtext`, `Ticket`.`richtext`, `Ticket`.`template`, `Ticket`.`menuindex`, `Ticket`.`searchable`, `Ticket`.`cacheable`, `Ticket`.`createdby`, `Ticket`.`createdon`, `Ticket`.`editedby`, `Ticket`.`editedon`, `Ticket`.`deleted`, `Ticket`.`deletedon`, `Ticket`.`deletedby`, `Ticket`.`publishedon`, `Ticket`.`publishedby`, `Ticket`.`menutitle`, `Ticket`.`donthit`, `Ticket`.`privateweb`, `Ticket`.`privatemgr`, `Ticket`.`content_dispo`, `Ticket`.`hidemenu`, `Ticket`.`class_key`, `Ticket`.`context_key`, `Ticket`.`content_type`, `Ticket`.`uri`, `Ticket`.`uri_override`, `Ticket`.`hide_children_in_tree`, `Ticket`.`show_in_tree`, `Ticket`.`properties`, `Total`.`comments`, `Total`.`views`, `Total`.`stars`, `Total`.`rating`, `Total`.`rating_plus`, `Total`.`rating_minus`, IFNULL(`TVimg`.`value`, '') AS `img` FROM `modx_site_content` AS `Ticket` LEFT JOIN `modx_site_content` `Section` ON `Section`.`id` = `Ticket`.`parent` LEFT JOIN `modx_users` `User` ON `User`.`id` = `Ticket`.`createdby` LEFT JOIN `modx_user_attributes` `Profile` ON `Profile`.`internalKey` = `User`.`id` LEFT JOIN `modx_tickets_totals` `Total` ON `Ticket`.`id` =  `Total`.`id` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVimg` ON `TVimg`.`contentid` = `Ticket`.`id` AND `TVimg`.`tmplvarid` = 1 WHERE  ( `Ticket`.`class_key` = 'Ticket' AND `Ticket`.`parent` IN (15,39,40,41) AND `Ticket`.`published` = 1 AND `Ticket`.`deleted` = 0 )  GROUP BY Ticket.id ORDER BY Ticket.createdon DESC LIMIT 3 "
    0.0017681: SQL executed
    0.0000880: Rows fetched
    0.0002060: Returning raw data
    0.0013721: Returning processed chunks
    0.2712450: Total time
    8 650 752: Memory usage
      Андрей
      16 апреля 2018, 13:54
      0
      Весьма странная ситуация. Если есть возможность, пришлите доступы в личку, посмотрим что за чудо такое.
    Константин
    16 апреля 2018, 22:43
    0
    Вопрос решен. Спасибо Андрею за помощь.
      Alex
      26 августа 2020, 20:07
      0
      Вот если бы решение вопроса тут описали — цены бы вам не было!
      biper
      04 февраля 2022, 09:46
      0
      Собираю сайт на Modx revo: pdoTools 3.0.0-beta, tickets-1.13.0-pl, php – 7.4 Modx revo — 3.0.0-beta2
      После того, как включаю в шаблон страницы вызов стандартного сниппета [[!TicketComments? &allowGuest=1]] страница с этим шаблоном выдает ошибку 500

      логи вот
      [03-Feb-2022 14:26:50 Europe/Moscow] PHP Notice: Undefined index: modUser in /home/s/shevam00/prodlenka-club.ru/wisky/core/vendor/xpdo/xpdo/src/xPDO/xPDOMap.php on line 44
      [03-Feb-2022 14:26:50 Europe/Moscow] PHP Notice: Indirect modification of overloaded element of xPDO\xPDOMap has no effect in /home/s/shevam00/prodlenka-club.ru/wisky/core/components/tickets/model/tickets/metadata.mysql.php on line 26
      [03-Feb-2022 14:26:50 Europe/Moscow] PHP Fatal error: Uncaught Error: Call to a member function setConfig() on null in /home/s/shevam00/prodlenka-club.ru/wisky/core/components/tickets/model/tickets/tickets.class.php:1415
      Stack trace:
      #0 /home/s/shevam00/prodlenka-club.ru/wisky/core/components/tickets/model/tickets/tickets.class.php(100): Tickets->loadPdoTools()
      #1 /home/s/shevam00/prodlenka-club.ru/wisky/core/cache/includes/elements/modx/revolution/modsnippet/52.include.cache.php(23): Tickets->initialize('web', Array)
      #2 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modScript.php(88): include('/home/s/shevam0...')
      #3 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modParser.php(505): MODX\Revolution\modScript->process(NULL)
      #4 /home/s/shevam00/prodlenka-club.ru/wisky/core/components/pdotools/src/Parsing/Parser.php(273): MODX\Revolution\modParser->processTag(Array, true)
      #5 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modParser.php(218): ModxPro\PdoTools\Parsing\Parser->processTag(Array, true)
      #6 /home/s/shevam00/prodlenka-club.ru/wisky/core/components/pdotools/src/Parsing/Parser.php(70): MODX\Revolution\modParser->processElementTags('', '<!doctype html>...', true, false, '[[', ']]', Array, 9)
      #7 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modResource.php(521): ModxPro\PdoTools\Parsing\Parser->processElementTags('', '<!doctype html>...', true, false, '[[', ']]', Array, 10)
      #8 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modResource.php(469): MODX\Revolution\modResource->parseContent()
      #9 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modResponse.php(72): MODX\Revolution\modResource->prepare()
      #10 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modRequest.php(154): MODX\Revolution\modResponse->outputContent(Array)
      #11 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modRequest.php(138): MODX\Revolution\modRequest->prepareResponse()
      #12 /home/s/shevam00/prodlenka-club.ru/wisky/core/src/Revolution/modX.php(1495): MODX\Revolution\modRequest->handleRequest()
      #13 /home/s/shevam00/prodlenka-club.ru/public_html/index.php(55): MODX\Revolution\modX->handleRequest()
      #14 {main}
      thrown in /home/s/shevam00/prodlenka-club.ru/wisky/core/components/tickets/model/tickets/tickets.class.php on line 1415

      получается что сбой при обработке вот этого выражения (1411-1419)

      public function loadPdoTools()
      {
      if (!is_object($this->pdoTools) || !($this->pdoTools instanceof pdoTools)) {
      $this->pdoTools = $this->modx->getService('pdoFetch');
      $this->pdoTools->setConfig($this->config);
      }

      return !empty($this->pdoTools) && $this->pdoTools instanceof pdoTools;
      }
      Не понимаю что происходит и как побороть, не хватает образования 😊 я ить в большей мере художник… Помогите, чем можете :)
        Николай Савин
        04 февраля 2022, 09:50
        0
        Здравствуйте. Компонент Tickets не работает с MODX3.
          biper
          04 февраля 2022, 09:53
          0
          вот черт! Вроде уже есть бета версия Tickets 1.14? может есть возможность получить и поставить ее… чтоб заработало…? :)
      Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.
      10