[[+content_image]]
G
G
GalileoGalileu2020-05-31 15:43:40
MODX
GalileoGalileu, 2020-05-31 15:43:40

The product is not displayed using "msProduct". What is the problem here and how to solve it?

In the online store there is a catalog of goods with products displayed there
, it looks like this

<!-- store products -->
          <div class="row">
              <!-- product -->
              [[!pdoPage?
              &element=`msProducts`
              &tpl=`gridProductTpl`
              &limit=`12`
              ]]
                                                 <!-- /product -->
            </div>

And everything works.
But why can't I display the product on the main page in the slider in the same way?
<div class="col-md-12">
  <div class="row">
    <div class="products-tabs">
      <!-- tab -->
      <div id="tab1" class="tab-pane active">
        <div class="products-slick" data-nav="#slick-nav-1">
          <!-- product -->
              	[[!msProducts?
                        &tpl=`productInSlider`
                        &limit=`5`
                        &sortdir=`DESC`
                    ]]
          <!-- /product -->
        </div>
        <div id="slick-nav-1" class="products-slick-nav"></div>
      </div>
      <!-- /tab -->
    </div>
  </div>
</div>

Yes, there through msProduct, but it also works in categories

Tell me what's wrong?

Called chunk code:
"gridProductTpl"
<div class="col-md-4 col-xs-6">
  <div class="product">
      <form method="post" class="ms2_form d-flex flex-column flex-md-row align-items-center no-gutters">
          <input type="hidden" name="id" value="{$id}">
            <input type="hidden" name="count" value="1">
            <input type="hidden" name="options" value="[]">
    		<div class="product-img">
    			<a href="{$id | url}">
                {if $image?}
                    <img src="{$image}"  alt="{$pagetitle}" title="{$pagetitle}"  data-echo="{$image}" alt="{$pagetitle}" title="{$pagetitle}" style="height:100%;width:100%;"/>
                {else}
                    <img src="{'assets_url' | option}components/minishop2/img/web/ms2_small.png"
                         srcset="{'assets_url' | option}components/minishop2/img/web/[email protected] 2x"
                         class="mw-100" alt="{$pagetitle}" title="{$pagetitle}"/>
                {/if}
            </a>
    			<div class="product-label">
    				<span class="sale">-30%</span>
    				 {if $new?}
                        <span class="new">NEW</span>
                    {/if}
    				
    			</div>
    		</div>
    		<div class="product-body">
    			<p class="product-category">[[#[[+parent]].pagetitle]]</p>
    			<h3 class="product-name"><a href="{$id | url}" class="font-weight-bold">{$pagetitle}</a></h3>
    			<h4 class="product-price">{$price}<i class="fa fa-btc" id="icon-btc"></i><del class="product-old-price">{if $old_price?}{$old_price}<i class="fa fa-btc" style="margin-left:3px;"></i>{/if}</del></h4>
    			<div class="product-rating">
    				<i class="fa fa-star"></i>
    				<i class="fa fa-star"></i>
    				<i class="fa fa-star"></i>
    				<i class="fa fa-star"></i>
    				<i class="fa fa-star"></i>
    			</div>
    			<div class="product-btns">
    				<button class="add-to-wishlist"><i class="fa fa-heart-o"></i><span class="tooltipp">add to wishlist</span></button>
    				<button class="add-to-compare"><i class="fa fa-exchange"></i><span class="tooltipp">add to compare</span></button>
    				<button class="quick-view"><i class="fa fa-eye"></i><span class="tooltipp">quick view</span></button>
    			</div>
    		</div>
    		<div class="add-to-cart">
    			<button type="submit" class="ms2_product add-to-cart-btn" id="btnAdd2Crt" name="ms2_action" value="cart/add" style="margin-left:10px; position:relative;"><i class="fa fa-shopping-cart" aria-hidden="true"></i>В корзину</button>
    		</div>
    </form>
  </div>
</div>


"productInSlider"
<div class="product">
        <form method="post" class="ms2_form d-flex flex-column flex-md-row align-items-center no-gutters">
            <input type="hidden" name="id" value="{$id}">
            <input type="hidden" name="count" value="1">
            <input type="hidden" name="options" value="[]">
        	<div class="product-img">
        	    <a href="{$id | url}">
                    {if $image?}
                        <img src="{$image}"  alt="{$pagetitle}" title="{$pagetitle}"  data-echo="{$image}" alt="{$pagetitle}" title="{$pagetitle}" style="height:100%;width:100%;"/>
                    {else}
                        <img src="{'assets_url' | option}components/minishop2/img/web/ms2_small.png"
                             srcset="{'assets_url' | option}components/minishop2/img/web/[email protected] 2x"
                             class="mw-100" alt="{$pagetitle}" title="{$pagetitle}"/>
                    {/if}
                </a>
        		<div class="product-label">
        			<span class="sale">-30%</span>
        				{if $new?}
                            <span class="new">NEW</span>
                        {/if}
        		</div>
        	</div>
        	<div class="product-body">
        		<p class="product-category">[[#[[+parent]].pagetitle]]</p>
        		<h3 class="product-name"><a href="#">{$pagetitle}</a></h3>
        		<h4 class="product-price">{$price} <del class="product-old-price">{if $old_price?}{$old_price}<i class="fa fa-btc" style="margin-left:3px;"></i>{/if}</del></h4>
        		<div class="product-rating">
        			<i class="fa fa-star"></i>
        			<i class="fa fa-star"></i>
        			<i class="fa fa-star"></i>
        			<i class="fa fa-star"></i>
        			<i class="fa fa-star"></i>
        		</div>
        		<div class="product-btns">
        			<button class="add-to-wishlist"><i class="fa fa-heart-o"></i><span class="tooltipp">add to wishlist</span></button>
        			<button class="add-to-compare"><i class="fa fa-exchange"></i><span class="tooltipp">add to compare</span></button>
        			<button class="quick-view"><i class="fa fa-eye"></i><span class="tooltipp">quick view</span></button>
        		</div>
        	</div>
        	<div class="add-to-cart">
        		<button type="submit" class="ms2_product add-to-cart-btn"  name="ms2_action" value="cart/add" style="margin-left:10px; position:relative;"><i class="fa fa-shopping-cart" aria-hidden="true"></i>В корзину</button>
        	</div>
        </form>	
    </div>


Let me remind you again. Both chunks work in categories, and neither of them displays the product on the main page in the slider

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
F
Froggyweb, 2020-05-31
@GalileoGalileu

you are probably trying to display products on a page where there are no child documents with products.
at least you need to specify where to get goods like &parents=`id of the resource with goods`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question