%IF $opt_layout AND NOT $LAYOUT_block_id THEN $LAYOUT_block_id=1 ENDIF
$toplist_opened_div=0
$tl_counter=1
QUERY GetSalesTopList(toplist_id=$LAYOUT_block_id) DO
DISPLAY
IF $show_toplist OR $opt_layout THEN
IF $Rownum==1 THEN $toplist_opened_div=1%>
<%$xView='DEFAULT'
$xTransform='RS_TPTHUMBS'
IF $GetSalesTopList.tlo_showproductimage AND NOT $GetSalesTopList.tlo_showvariantimage THEN
QUERY MyProductPicture(product_id=$product_id, xView=$xView, xTransform=$xTransform) DO DISPLAY%>
<%NEXTROW ENDQUERY
ENDIF%>
<%IF $GetSalesTopList.tlo_showvariantimage THEN
IF $variant_id THEN
QUERY Variant(variant_id=$variant_id) DO DISPLAY%>
<%IF $Variant.picture_id THEN%>
<%ELSE
QUERY MyProductPicture(product_id=$product_id, xView=$xView, xTransform=$xTransform) DO DISPLAY%>
<%NEXTROW ENDQUERY
ENDIF
NEXTROW ENDQUERY
ELSE
QUERY MyProductPicture(product_id=$product_id, xView=$xView, xTransform=$xTransform) DO DISPLAY%>
<%NEXTROW ENDQUERY
ENDIF
ENDIF%>
<%IF $GetSalesTopList.tlo_shownumbering OR $GetSalesTopList.tlo_showproductdescr THEN%>
<%ENDIF%>
<%IF $product_id THEN
QUERY SingleProductVariant(product_id=$product_id) DO DISPLAY%>
<%IF $GetSalesTopList.tlo_showprice AND (($Customer.login AND $opt_price_for_reg_user) OR (NOT $opt_price_for_reg_user)) THEN%>