Дублируется один товар в каталоге
Всем здравствуйте, возникла ситуация, когда в каталоге выводится (дублируется) один и тот же товар 5 раз. Уже переписал чанки вывода, все равно 5 раз дублирует…
Может кто-то сталкивался с такой ситуацией?
Можете подсказать в какую сторону смотреть.
Вывод товаров такой:
Чанк gridProductTpl:
Может кто-то сталкивался с такой ситуацией?
Можете подсказать в какую сторону смотреть.
Вывод товаров такой:
{$_modx->runSnippet('!mFilter2', [
'element' => 'msProducts',
'class' => 'msProduct',
'limit' => 12,
'tplOuter' => 'mFilter2OuterTpl',
'tpl' => 'gridProductTpl',
'includeTVs' => 'available',
'includeThumbs' => 'medium',
'sortby' => '{ "parent":"ASC","menuindex":"ASC" }',
'tplPagePrev' => '@INLINE <li><a class="" href="{$href}"><i class="fa fa-angle-left" aria-hidden="true"></i></a></li>',
'tplPageNext' => '@INLINE <li><a class="" href="{$href}"><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>',
'tplPagePrevEmpty' => '@INLINE <li><a class="" href="{$href}"><i class="fa fa-angle-left" aria-hidden="true"></i></a></li>',
'tplPageNextEmpty' => '@INLINE <li><a class="" href="{$href}"><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>',
'tplPageFirst' => '',
'tplPageLast' => '',
'tplPageFirstEmpty' => '',
'tplPageLastEmpty' => '',
'filters' => 'msoption|marka,
msoption|model,
ms|vendor:vendors,
parent:parents',
'aliases' => 'ms|vendor==vendor,
msoption|marka==marka,
msoption|model==model',
'tplFilter.outer.default' => 'filterSelectOuter',
'tplFilter.row.default' => 'filterSelectRow',
'tplFilter.outer.vendor' => 'filterCheckboxOuter',
'tplFilter.row.vendor' => 'filterCheckboxRow',
'tplFilter.outer.marka' => 'filterSelectOuter',
'tplFilter.row.marka' => 'filterSelectRow',
'tplFilter.outer.model' => 'filterSelectOuter',
'tplFilter.row.model' => 'filterSelectRow',
'tplFilter.outer.resource|parent:parents' => 'filterSelectOuter',
'tplFilter.row.resource|parent:parents' => 'filterSelectRow',
])}
Чанк gridProductTpl:
<div class="ms2_product col-xs-6 col-sm-4 col-md-4 col-lg-3 product-item" itemtype="http://schema.org/Product" itemscope>
<meta itemprop="description" content="{$description = $description ?: $pagetitle}">
<form method="post" class="ms2_form">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" name="count" value="1">
<input type="hidden" name="options" value="[]">
<div class="product-images">
{$_modx->runSnippet('msGallery', [
'product' => $id,
'tpl'=> 'msGalleryProductTpl'
])}
{if $new?}<div class="ribbon-new ver2"><span>Новинка</span></div>{/if}
{if $popular?}<div class="ribbon-sale ver2"><span>Распродажа</span></div>{/if}
{if $favorite?}<div class="ribbon-popular ver2"><span>Популярный</span></div>{/if}
</div>
<div class="product-info-ver2" itemtype="http://schema.org/AggregateOffer" itemprop="offers" itemscope>
<meta itemprop="category" content="{$parent | resource: "pagetitle"}">
<meta itemprop="name" content="{$pagetitle}">
<meta itemprop="offerCount" content="1">
<meta itemprop="price" content="{$price | replace:" ":""}">
<meta itemprop="lowPrice" content="{$price | replace:" ":""}">
<meta itemprop="priceCurrency" content="RUR">
<h3 class="product-title"><a href="{$id | url}" title="{$pagetitle}">{$pagetitle}</a> </h3>
<div class="product-after-switch">
<div class="product-price">{$price} {'ms2_frontend_currency' | lexicon}</div>
</div>
<p class="product-desc">{$introtext}</p>
<div class="product-price">{$price} {'ms2_frontend_currency' | lexicon}</div>
{if $old_price?}<del class="sale-price"><span class="money">{$old_price} {'ms2_frontend_currency' | lexicon}</span></del> {/if}
<div class="button-group">
<a href="#" class="button add-to-cart">Заказать</a>
<a href="#" class="button add-to-wishlist">Add to wishlist</a>
<a href="#" class="button add-view quickview" data-click data-data-element="msProductContentTpl" data-data-topics='["minishop2:product"]' data-data-id="[[+id]]" data-dialog-title="" data-dialog-size="size-wide" class="awe-button product-quick-view btn-quickview" data-toggle="tooltip" title="Быстрый просмотр">Quick view</a>
</div>
</div>
</form>
</div>
Комментарии: 19
Для mFilter2 добавьте toPlaceholders
'toPlaceholders' => 'my.',
<div id="mse2_results">{$_pls['my.results']}</div>
Добавил, пустая страница, никакой товар не выводится…
Для справки: сколько картинок в галерее товара, который дублируется?
modx.pro/components/22950#comment-134038
modx.pro/components/22950#comment-134038
5 картинок, 5 раз дублируется товар. Прочел заметку. А как решить вопрос? Обновить минишоп?
skrinshoter.ru/s/260522/VQZzCu16
В сниппете msProducts можно закомментить эту строку. Но это костыль до первого обновлёния.
Или обновить — modx.pro/components/22950#comment-134211
В сниппете msProducts можно закомментить эту строку. Но это костыль до первого обновлёния.
Или обновить — modx.pro/components/22950#comment-134211
Спасибо большое!
Не могу найти такой строчки в сниппете mFilter2
mFilter2 тут не при чем! Речь идет про msProducts
Спасибо, помогло. А в чем была проблема? На других сайтах такого не наблюдается.
Можно проще добавить groupby
groupby — это параметр сниппета? Куда добавить groupby?
в вызов снипета
'groupby' => 'id',
'groupby' => 'id',
Добавил, все равно товар дублируется…
Добавьте
'showLog' => 1
И посмотрите, какой запрос формируется.
0.0000961: pdoTools loaded.
0.0001519: Conditions prepared
0.0000250: xPDO query object created
0.0003450: Included list of tvs: available
0.0001450: leftJoined msProductData as Data
0.0000710: leftJoined msVendor as Vendor
0.0000811: leftJoined msProductFile as medium
0.0000720: leftJoined modTemplateVarResource as TVavailable
0.0000021: Grouped by msProduct.id, `medium`.url
0.0001230: Added selection of msProduct: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `alias_visible`, `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`, `seotabs_searchable`
0.0000441: Added selection of msProductData: `article`, `price`, `old_price`, `weight`, `image`, `thumb`, `vendor`, `made_in`, `new`, `popular`, `favorite`, `tags`, `color`, `size`, `source`
0.0000432: Added selection of msVendor: `name` AS `vendor.name`, `resource` AS `vendor.resource`, `country` AS `vendor.country`, `logo` AS `vendor.logo`, `address` AS `vendor.address`, `phone` AS `vendor.phone`, `fax` AS `vendor.fax`, `email` AS `vendor.email`, `description` AS `vendor.description`, `properties` AS `vendor.properties`
0.0000269: Added selection of msProductFile: url as `medium`
0.0000069: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `available`
0.0000100: Replaced TV conditions
0.0000260: Processed additional conditions
0.0001669: Added where condition: class_key=msProduct, msProduct.id:IN(4,4,4,4,4,27,28), msProduct.published=1, msProduct.deleted=0
0.0000062: Replaced TV conditions
0.0000670: Sorted by msProduct.parent, ASC
0.0000851: Sorted by msProduct.menuindex, ASC
0.0000029: Limited to 12, offset 0
0.0002210: SQL prepared «SELECT SQL_CALC_FOUND_ROWS `msProduct`.`id`, `msProduct`.`type`, `msProduct`.`contentType`, `msProduct`.`pagetitle`, `msProduct`.`longtitle`, `msProduct`.`description`, `msProduct`.`alias`, `msProduct`.`alias_visible`, `msProduct`.`link_attributes`, `msProduct`.`published`, `msProduct`.`pub_date`, `msProduct`.`unpub_date`, `msProduct`.`parent`, `msProduct`.`isfolder`, `msProduct`.`introtext`, `msProduct`.`richtext`, `msProduct`.`template`, `msProduct`.`menuindex`, `msProduct`.`searchable`, `msProduct`.`cacheable`, `msProduct`.`createdby`, `msProduct`.`createdon`, `msProduct`.`editedby`, `msProduct`.`editedon`, `msProduct`.`deleted`, `msProduct`.`deletedon`, `msProduct`.`deletedby`, `msProduct`.`publishedon`, `msProduct`.`publishedby`, `msProduct`.`menutitle`, `msProduct`.`donthit`, `msProduct`.`privateweb`, `msProduct`.`privatemgr`, `msProduct`.`content_dispo`, `msProduct`.`hidemenu`, `msProduct`.`class_key`, `msProduct`.`context_key`, `msProduct`.`content_type`, `msProduct`.`uri`, `msProduct`.`uri_override`, `msProduct`.`hide_children_in_tree`, `msProduct`.`show_in_tree`, `msProduct`.`properties`, `msProduct`.`seotabs_searchable`, `Data`.`article`, `Data`.`price`, `Data`.`old_price`, `Data`.`weight`, `Data`.`image`, `Data`.`thumb`, `Data`.`vendor`, `Data`.`made_in`, `Data`.`new`, `Data`.`popular`, `Data`.`favorite`, `Data`.`tags`, `Data`.`color`, `Data`.`size`, `Data`.`source`, `Vendor`.`name` AS `vendor.name`, `Vendor`.`resource` AS `vendor.resource`, `Vendor`.`country` AS `vendor.country`, `Vendor`.`logo` AS `vendor.logo`, `Vendor`.`address` AS `vendor.address`, `Vendor`.`phone` AS `vendor.phone`, `Vendor`.`fax` AS `vendor.fax`, `Vendor`.`email` AS `vendor.email`, `Vendor`.`description` AS `vendor.description`, `Vendor`.`properties` AS `vendor.properties`, `medium`.url as `medium`, IFNULL(`TVavailable`.`value`, '') AS `available` FROM `modx_site_content` AS `msProduct` LEFT JOIN `modx_ms2_products` `Data` ON `msProduct`.`id` = `Data`.`id` LEFT JOIN `modx_ms2_vendors` `Vendor` ON Data.vendor=Vendor.id LEFT JOIN `modx_ms2_product_files` `medium` ON `medium`.product_id = msProduct.id AND `medium`.`rank` = 0 AND `medium`.path LIKE '%/medium/%' LEFT JOIN `modx_site_tmplvar_contentvalues` `TVavailable` ON `TVavailable`.`contentid` = `msProduct`.`id` AND `TVavailable`.`tmplvarid` = 3 WHERE ( `msProduct`.`class_key` = 'msProduct' AND `msProduct`.`id` IN (4,4,4,4,4,27,28) AND `msProduct`.`published` = 1 AND `msProduct`.`deleted` = 0 ) GROUP BY msProduct.id, `medium`.url ORDER BY msProduct.parent ASC, msProduct.menuindex ASC LIMIT 12 „
0.0016711: SQL executed
0.0001159: Total rows: 7
0.0000899: Rows fetched
0.0001149: Returning raw data
0.0008242: Checked the active modifiers
0.0021989: Loaded “modChunk» with name «gridProductTpl»
0.0020950: Compiled Fenom chunk with name «modchunk/54»
0.0014119: Loaded «modSnippet» with name «msGallery»
0.0044742: Time to load products options
0.1365609: Total time
6 291 456: Memory usage
0.0001519: Conditions prepared
0.0000250: xPDO query object created
0.0003450: Included list of tvs: available
0.0001450: leftJoined msProductData as Data
0.0000710: leftJoined msVendor as Vendor
0.0000811: leftJoined msProductFile as medium
0.0000720: leftJoined modTemplateVarResource as TVavailable
0.0000021: Grouped by msProduct.id, `medium`.url
0.0001230: Added selection of msProduct: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `alias_visible`, `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`, `seotabs_searchable`
0.0000441: Added selection of msProductData: `article`, `price`, `old_price`, `weight`, `image`, `thumb`, `vendor`, `made_in`, `new`, `popular`, `favorite`, `tags`, `color`, `size`, `source`
0.0000432: Added selection of msVendor: `name` AS `vendor.name`, `resource` AS `vendor.resource`, `country` AS `vendor.country`, `logo` AS `vendor.logo`, `address` AS `vendor.address`, `phone` AS `vendor.phone`, `fax` AS `vendor.fax`, `email` AS `vendor.email`, `description` AS `vendor.description`, `properties` AS `vendor.properties`
0.0000269: Added selection of msProductFile: url as `medium`
0.0000069: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `available`
0.0000100: Replaced TV conditions
0.0000260: Processed additional conditions
0.0001669: Added where condition: class_key=msProduct, msProduct.id:IN(4,4,4,4,4,27,28), msProduct.published=1, msProduct.deleted=0
0.0000062: Replaced TV conditions
0.0000670: Sorted by msProduct.parent, ASC
0.0000851: Sorted by msProduct.menuindex, ASC
0.0000029: Limited to 12, offset 0
0.0002210: SQL prepared «SELECT SQL_CALC_FOUND_ROWS `msProduct`.`id`, `msProduct`.`type`, `msProduct`.`contentType`, `msProduct`.`pagetitle`, `msProduct`.`longtitle`, `msProduct`.`description`, `msProduct`.`alias`, `msProduct`.`alias_visible`, `msProduct`.`link_attributes`, `msProduct`.`published`, `msProduct`.`pub_date`, `msProduct`.`unpub_date`, `msProduct`.`parent`, `msProduct`.`isfolder`, `msProduct`.`introtext`, `msProduct`.`richtext`, `msProduct`.`template`, `msProduct`.`menuindex`, `msProduct`.`searchable`, `msProduct`.`cacheable`, `msProduct`.`createdby`, `msProduct`.`createdon`, `msProduct`.`editedby`, `msProduct`.`editedon`, `msProduct`.`deleted`, `msProduct`.`deletedon`, `msProduct`.`deletedby`, `msProduct`.`publishedon`, `msProduct`.`publishedby`, `msProduct`.`menutitle`, `msProduct`.`donthit`, `msProduct`.`privateweb`, `msProduct`.`privatemgr`, `msProduct`.`content_dispo`, `msProduct`.`hidemenu`, `msProduct`.`class_key`, `msProduct`.`context_key`, `msProduct`.`content_type`, `msProduct`.`uri`, `msProduct`.`uri_override`, `msProduct`.`hide_children_in_tree`, `msProduct`.`show_in_tree`, `msProduct`.`properties`, `msProduct`.`seotabs_searchable`, `Data`.`article`, `Data`.`price`, `Data`.`old_price`, `Data`.`weight`, `Data`.`image`, `Data`.`thumb`, `Data`.`vendor`, `Data`.`made_in`, `Data`.`new`, `Data`.`popular`, `Data`.`favorite`, `Data`.`tags`, `Data`.`color`, `Data`.`size`, `Data`.`source`, `Vendor`.`name` AS `vendor.name`, `Vendor`.`resource` AS `vendor.resource`, `Vendor`.`country` AS `vendor.country`, `Vendor`.`logo` AS `vendor.logo`, `Vendor`.`address` AS `vendor.address`, `Vendor`.`phone` AS `vendor.phone`, `Vendor`.`fax` AS `vendor.fax`, `Vendor`.`email` AS `vendor.email`, `Vendor`.`description` AS `vendor.description`, `Vendor`.`properties` AS `vendor.properties`, `medium`.url as `medium`, IFNULL(`TVavailable`.`value`, '') AS `available` FROM `modx_site_content` AS `msProduct` LEFT JOIN `modx_ms2_products` `Data` ON `msProduct`.`id` = `Data`.`id` LEFT JOIN `modx_ms2_vendors` `Vendor` ON Data.vendor=Vendor.id LEFT JOIN `modx_ms2_product_files` `medium` ON `medium`.product_id = msProduct.id AND `medium`.`rank` = 0 AND `medium`.path LIKE '%/medium/%' LEFT JOIN `modx_site_tmplvar_contentvalues` `TVavailable` ON `TVavailable`.`contentid` = `msProduct`.`id` AND `TVavailable`.`tmplvarid` = 3 WHERE ( `msProduct`.`class_key` = 'msProduct' AND `msProduct`.`id` IN (4,4,4,4,4,27,28) AND `msProduct`.`published` = 1 AND `msProduct`.`deleted` = 0 ) GROUP BY msProduct.id, `medium`.url ORDER BY msProduct.parent ASC, msProduct.menuindex ASC LIMIT 12 „
0.0016711: SQL executed
0.0001159: Total rows: 7
0.0000899: Rows fetched
0.0001149: Returning raw data
0.0008242: Checked the active modifiers
0.0021989: Loaded “modChunk» with name «gridProductTpl»
0.0020950: Compiled Fenom chunk with name «modchunk/54»
0.0014119: Loaded «modSnippet» with name «msGallery»
0.0044742: Time to load products options
0.1365609: Total time
6 291 456: Memory usage
Ответить даже если предположить, что проблема в этом: AND `msProduct`.`id` IN (4,4,4,4,4,27,28)
Запрос выводит 7 строк, хотя долен 3.
Попробуйте уберите: 'includeThumbs' => 'medium'
Запрос выводит 7 строк, хотя долен 3.
Попробуйте уберите: 'includeThumbs' => 'medium'
Убрал 'includeThumbs' => 'medium' — дубли пропали. Как так?
Ну вам там выше писали. В чем проблема. Можете, просто выводить картинки из thumb, если нужны medium:
{$thumb | replace: "/small/" : "/medium/"}
Вывод:
{$_modx->runSnippet('!mFilter2', [
'element' => 'msProducts',
'class' => 'msProduct',
'limit' => 12,
'tplOuter' => 'mFilter2OuterTpl',
'tpl' => 'gridProductTpl',
'includeTVs' => 'available',
'includeThumbs' => 'medium',
'sortby' => '{ "parent":"ASC","menuindex":"ASC" }',
'tplPagePrev' => '@INLINE <li><a class="" href="{$href}"><i class="fa fa-angle-left" aria-hidden="true"></i></a></li>',
'tplPageNext' => '@INLINE <li><a class="" href="{$href}"><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>',
'tplPagePrevEmpty' => '@INLINE <li><a class="" href="{$href}"><i class="fa fa-angle-left" aria-hidden="true"></i></a></li>',
'tplPageNextEmpty' => '@INLINE <li><a class="" href="{$href}"><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>',
'tplPageFirst' => '',
'tplPageLast' => '',
'tplPageFirstEmpty' => '',
'groupby' => 'id',
'tplPageLastEmpty' => '',
'suggestionsRadio' => 'resource|parent',
'filters' => 'msoption|marka,
msoption|model,
ms|vendor:vendors,
parent:parents',
'aliases' => 'ms|vendor==vendor,
msoption|marka==marka,
msoption|model==model',
'tplFilter.outer.default' => 'filterSelectOuter',
'tplFilter.row.default' => 'filterSelectRow',
'tplFilter.outer.vendor' => 'filterCheckboxOuter',
'tplFilter.row.vendor' => 'filterCheckboxRow',
'tplFilter.outer.marka' => 'filterSelectOuter',
'tplFilter.row.marka' => 'filterSelectRow',
'tplFilter.outer.model' => 'filterSelectOuter',
'tplFilter.row.model' => 'filterSelectRow',
'tplFilter.outer.resource|parent:parents' => 'filterSelectOuter',
'tplFilter.row.resource|parent:parents' => 'filterSelectRow',
])}
Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.