Notice: Undefined index: category in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 58 Notice: Trying to get property of non-object in /home/u1860 Есть решение

Notice: Undefined index: category in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 58


Notice: Trying to get property of non-object in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 58


Notice: Undefined index: category in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 65


Notice: Trying to get property of non-object in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 65

12 ответов

  • 1

    в шаблоне home.html идет обращение к несуществующей переменной.
    решить можно проверкой {if !empty($category)}
    вместо $category может быть что-то другое, например $p.category

    • +1
      badeamare badeamare 1 февраля 2017 11:15 #

      Нет такого кода как {if !empty($category)}

      Есть {if !empty($theme_settings.promo)}, {if !empty($frontend_homepage)}, {if !empty($theme_settings.promo)}

      • +2

        могу дать 100%, что в файле шаблона home.html есть переменная category
        пройдите поиском по этому шаблону

        • +1
          badeamare badeamare 1 февраля 2017 11:20 #

          category есть но все вроде как правильно


          {$compare_p = waRequest::cookie('shop_compare', array(), waRequest::TYPE_ARRAY_INT)}
          <div class="row-fluid">
          	<div class="span12 padding20">
          			{if $wa->isMobile()}
          			<!-- Слайдер для мобильных устройств -->
          			{$wa->block("slaider_mobil")}
          			
          			{/if}
          			<!-- Слайдер для мобильных устройств --
          			<!-- Слайдер для ПК устройств -->
                        {$wa->block("slaider")}	
                      
          <!--Категории-->
          <h6>Категории товаров</h6> 
          			{if shopWmimageincatPlugin::getCategoryImage($category.id, 'banner')}
          <div><img src="{shopWmimageincatPlugin::getCategoryImage($category.id, 'banner')}" alt="{if $wa->shop && shopWmimageincatPlugin::getCategoryImage($category.id, 'icon')} <img src="{shopWmimageincatPlugin::getCategoryImage($category.id, 'icon')}" style="vertical-align:middle; margin-right:5px;" /> {/if}{$category.name}" title="{$category.description|strip_tags}" /></div>
          {/if}
          {if $category.id}
          {$category_list = $wa->shop->categories($category.id, 1)}
          {else}
          {$category_list = $wa->shop->categories(0, 0)}
          {/if}
          
          <ul class="category_list">
          {*кол-во ячеек в строке*}{$num_cell = 4}
          {foreach $category_list as $cl}
          {if $cl@first || ($cl@index is div by $num_cell)}<li>{/if}
          <a class="name" href="{$cl.url}">
          {if shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}<div><img src="{shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}" /></div>{/if}
          <span>{$cl.name}</span></a>
          {if $cl@last || (($cl@index+1) is div by $num_cell)}</li>{/if}
          {/foreach}
          </ul>
          
          			<!--Категории-->
          
          
          		<!-- PROMOS -->
          		{if !empty($theme_settings.promo)}
          			{if $theme_settings.promo == 'center'}
          			<div id="promo_center">
          				{include file="`$wa_active_theme_path`/promo.html" inline}
          			</div>
          			{/if}
          		{/if}
          		<!-- Promo block -->
          		<div class="row-fluid">
          			<div class="span12">
          				<div class="row-fluid">
          					<div class="span9">
          						<div id="button_switch">
          						{$bestsellers = $wa->shop->productSet("bestsellers")}
          						{$promo = $wa->shop->productSet("promo")}
          						{if $bestsellers && $promo}
          							{if $bestsellers}
          								<a href='#' class="active" data-slider="bestsellers-block">[`Bestsellers`] </a>
          							{/if}
          							{if $promo}
          								<a href='#' data-slider="promo-block">[`New arrivals`] </a>
          							{/if}
          						{else}
          							<h1>[`Bestsellers`]</h1>
          							<hr class="thick">
          						{/if}
          						</div>
          						<!-- Bestsellers block -->
          						{if $bestsellers}
          						<div class="bestsellers-block productslider">
          							<div class="arrow-block{if $bestsellers && $promo} arrow-both{/if}">
          								<a href="#" id="prev-bestsellers"><img src="{$wa_theme_url}img/slide-arrow-left.png" alt="" width="31" height="31"/></a> <a href="#" id="next-bestsellers"><img src="{$wa_theme_url}img/slide-arrow-right.png" alt="" width="31" height="31"/></a>
          							</div>
          							<ul class="thumbs li200px product-thumbs" id="bestsellers">
          								{foreach $bestsellers as $p}
          									{include file="`$wa_active_theme_path`/thumbs.html" inline}
          								{/foreach}
          							</ul>
          						</div>
          						{/if}
          						<!-- Promo block -->
          						{if $promo}
          						<div class="promo-block productslider" style="visibility: hidden; height:0px;">
          							<div class="arrow-block{if $bestsellers && $promo} arrow-both{/if}">
          								<a href="#" id="prev-promo"><img src="{$wa_theme_url}img/slide-arrow-left.png" alt="" width="31" height="31"/></a> <a href="#" id="next-promo"><img src="{$wa_theme_url}img/slide-arrow-right.png" alt="" width="31" height="31"/></a>
          							</div>
          							<ul class="thumbs li200px product-thumbs" id="promo">
          								{foreach $promo as $p}
          									{include file="`$wa_active_theme_path`/thumbs.html" inline}
          								{/foreach}
          							</ul>
          						</div>
          						{/if}
          						{$discount = $wa->shop->productSet("discount")}
          						{if $discount}
          						<h1>[`Discount`]</h1>
          						<hr class="thick">
          						<ul class="thumbs li200px product-thumbs" id="promo">
          							{foreach $discount as $p}
          								{include file="`$wa_active_theme_path`/thumbs.html" inline}
          							{/foreach}
          						</ul>
          						{/if}
          						<div class="about-shop">
          							{if $wa->block("main_block")}{$wa->block("main_block")}{else}<div class="text-center">[`Add text about the company through the application of the "Site" -> "Blocks". Create a new block ID`] <b>main_block</b></div>{/if}
          							<!-- plugin hook: 'frontend_homepage' -->
          							{* @event frontend_homepage.%plugin_id% *}
          							{if !empty($frontend_homepage)}
          								{foreach $frontend_homepage as $_}{$_}{/foreach}
          							{/if}
          						</div>
          					</div>
          					<div class="span3">
          						{if !empty($theme_settings.promo)}
          							{if $theme_settings.promo == 'right'}
          							<div id="promo_right">
          								{include file="`$wa_active_theme_path`/promo.html" inline}
          							</div>
          							{/if}
          						{/if}
          						{if $wa->blog}
          							{$latest_posts = $wa->blog->posts(null, 5)}
          							{if $latest_posts}
          								{include file="`$wa_active_theme_path`/news.html" inline}
          							{/if}
          						{/if}
          						<!-- mailer -->
          						
          						<!-- tag cloud -->
          						{if $cloud = $wa->shop->tags()}
          						<div class="tags">
          							<h4>[`Tags`]</h4>
          							{foreach $cloud as $tag}
          							<a href="{$wa_app_url}tag/{$tag.uri_name}/">{$tag.name|escape}</a>
          							{/foreach}
          						</div>
          						{/if}
          					</div>
          				</div>
          			</div>
          		</div>
          	</div>
          </div>
          • 0
            {$compare_p = waRequest::cookie('shop_compare', array(), waRequest::TYPE_ARRAY_INT)}
            <div class="row-fluid">
                    <div class="span12 padding20">
                                    {if $wa->isMobile()}
                                    <!-- Слайдер для мобильных устройств -->
                                    {$wa->block("slaider_mobil")}
                                    
                                    {/if}
                                    <!-- Слайдер для мобильных устройств --
                                    <!-- Слайдер для ПК устройств -->
                          {$wa->block("slaider")}   
                        
            <!--Категории-->
            <h6>Категории товаров</h6> 
            {if !empty($category)}
            	{if shopWmimageincatPlugin::getCategoryImage($category.id, 'banner')}
            		<div><img src="{shopWmimageincatPlugin::getCategoryImage($category.id, 'banner')}" alt="{if $wa->shop && shopWmimageincatPlugin::getCategoryImage($category.id, 'icon')} <img src="{shopWmimageincatPlugin::getCategoryImage($category.id, 'icon')}" style="vertical-align:middle; margin-right:5px;" /> {/if}{$category.name}" title="{$category.description|strip_tags}" /></div>
            	{/if}
            {if !empty($category)}
            {$category_list = $wa->shop->categories($category.id, 1)}
            {else}
            {$category_list = $wa->shop->categories(0, 0)}
            {/if}
            
            <ul class="category_list">
            {*кол-во ячеек в строке*}{$num_cell = 4}
            {foreach $category_list as $cl}
            {if $cl@first || ($cl@index is div by $num_cell)}<li>{/if}
            <a class="name" href="{$cl.url}">
            {if shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}<div><img src="{shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}" /></div>{/if}
            <span>{$cl.name}</span></a>
            {if $cl@last || (($cl@index+1) is div by $num_cell)}</li>{/if}
            {/foreach}
            </ul>
            
                                    <!--Категории-->
            
            
                            <!-- PROMOS -->
                            {if !empty($theme_settings.promo)}
                                    {if $theme_settings.promo == 'center'}
                                    <div id="promo_center">
                                            {include file="`$wa_active_theme_path`/promo.html" inline}
                                    </div>
                                    {/if}
                            {/if}
                            <!-- Promo block -->
                            <div class="row-fluid">
                                    <div class="span12">
                                            <div class="row-fluid">
                                                    <div class="span9">
                                                            <div id="button_switch">
                                                            {$bestsellers = $wa->shop->productSet("bestsellers")}
                                                            {$promo = $wa->shop->productSet("promo")}
                                                            {if $bestsellers && $promo}
                                                                    {if $bestsellers}
                                                                            <a href='#' class="active" data-slider="bestsellers-block">[`Bestsellers`] </a>
                                                                    {/if}
                                                                    {if $promo}
                                                                            <a href='#' data-slider="promo-block">[`New arrivals`] </a>
                                                                    {/if}
                                                            {else}
                                                                    <h1>[`Bestsellers`]</h1>
                                                                    <hr class="thick">
                                                            {/if}
                                                            </div>
                                                            <!-- Bestsellers block -->
                                                            {if $bestsellers}
                                                            <div class="bestsellers-block productslider">
                                                                    <div class="arrow-block{if $bestsellers && $promo} arrow-both{/if}">
                                                                            <a href="#" id="prev-bestsellers"><img src="{$wa_theme_url}img/slide-arrow-left.png" alt="" width="31" height="31"/></a> <a href="#" id="next-bestsellers"><img src="{$wa_theme_url}img/slide-arrow-right.png" alt="" width="31" height="31"/></a>
                                                                    </div>
                                                                    <ul class="thumbs li200px product-thumbs" id="bestsellers">
                                                                            {foreach $bestsellers as $p}
                                                                                    {include file="`$wa_active_theme_path`/thumbs.html" inline}
                                                                            {/foreach}
                                                                    </ul>
                                                            </div>
                                                            {/if}
                                                            <!-- Promo block -->
                                                            {if $promo}
                                                            <div class="promo-block productslider" style="visibility: hidden; height:0px;">
                                                                    <div class="arrow-block{if $bestsellers && $promo} arrow-both{/if}">
                                                                            <a href="#" id="prev-promo"><img src="{$wa_theme_url}img/slide-arrow-left.png" alt="" width="31" height="31"/></a> <a href="#" id="next-promo"><img src="{$wa_theme_url}img/slide-arrow-right.png" alt="" width="31" height="31"/></a>
                                                                    </div>
                                                                    <ul class="thumbs li200px product-thumbs" id="promo">
                                                                            {foreach $promo as $p}
                                                                                    {include file="`$wa_active_theme_path`/thumbs.html" inline}
                                                                            {/foreach}
                                                                    </ul>
                                                            </div>
                                                            {/if}
                                                            {$discount = $wa->shop->productSet("discount")}
                                                            {if $discount}
                                                            <h1>[`Discount`]</h1>
                                                            <hr class="thick">
                                                            <ul class="thumbs li200px product-thumbs" id="promo">
                                                                    {foreach $discount as $p}
                                                                            {include file="`$wa_active_theme_path`/thumbs.html" inline}
                                                                    {/foreach}
                                                            </ul>
                                                            {/if}
                                                            <div class="about-shop">
                                                                    {if $wa->block("main_block")}{$wa->block("main_block")}{else}<div class="text-center">[`Add text about the company through the application of the "Site" -> "Blocks". Create a new block ID`] <b>main_block</b></div>{/if}
                                                                    <!-- plugin hook: 'frontend_homepage' -->
                                                                    {* @event frontend_homepage.%plugin_id% *}
                                                                    {if !empty($frontend_homepage)}
                                                                            {foreach $frontend_homepage as $_}{$_}{/foreach}
                                                                    {/if}
                                                            </div>
                                                    </div>
                                                    <div class="span3">
                                                            {if !empty($theme_settings.promo)}
                                                                    {if $theme_settings.promo == 'right'}
                                                                    <div id="promo_right">
                                                                            {include file="`$wa_active_theme_path`/promo.html" inline}
                                                                    </div>
                                                                    {/if}
                                                            {/if}
                                                            {if $wa->blog}
                                                                    {$latest_posts = $wa->blog->posts(null, 5)}
                                                                    {if $latest_posts}
                                                                            {include file="`$wa_active_theme_path`/news.html" inline}
                                                                    {/if}
                                                            {/if}
                                                            <!-- mailer -->
                                                            
                                                            <!-- tag cloud -->
                                                            {if $cloud = $wa->shop->tags()}
                                                            <div class="tags">
                                                                    <h4>[`Tags`]</h4>
                                                                    {foreach $cloud as $tag}
                                                                    <a href="{$wa_app_url}tag/{$tag.uri_name}/">{$tag.name|escape}</a>
                                                                    {/foreach}
                                                            </div>
                                                            {/if}
                                                    </div>
                                            </div>
                                    </div>
                            </div>
                    </div>
            </div>
            • +1
              badeamare badeamare 1 февраля 2017 11:29 #

              Выдает ошибку

              <h1>Ошибка #0</h1>


              Магазин

              <h2>Syntax Error in template "/home/u186064174/public_html/wa-data/public/shop/themes/shopping/home.html" on line 146 "" unclosed {if} tag</h2>

              Please contact app developer.


              Может в SQL гдето проблема?



              • +2

                а... забыл закрыть иф

                не выдумывайте. проблему я вам сказал

                {if !empty($category)}
                        {if shopWmimageincatPlugin::getCategoryImage($category.id, 'banner')}
                                <div><img src="{shopWmimageincatPlugin::getCategoryImage($category.id, 'banner')}" alt="{if $wa->shop && shopWmimageincatPlugin::getCategoryImage($category.id, 'icon')} <img src="{shopWmimageincatPlugin::getCategoryImage($category.id, 'icon')}" style="vertical-align:middle; margin-right:5px;" /> {/if}{$category.name}" title="{$category.description|strip_tags}" /></div>
                        {/if}
                        {/if}
                • +1
                  badeamare badeamare 1 февраля 2017 11:46 #

                  Отлично две строки пропали ищо две остались

                  Notice:  Undefined index: category in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 67
                  Notice: Trying to get property of non-object in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 67

                  В этом коде остались

                  <ul class="category_list">
                  {*кол-во ячеек в строке*}{$num_cell = 4}
                  {foreach $category_list as $cl}
                  {if $cl@first || ($cl@index is div by $num_cell)}<li>{/if}
                  <a class="name" href="{$cl.url}">
                  {if shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}<div><img src="{shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}" /></div>{/if}
                  <span>{$cl.name}</span></a>
                  {if $cl@last || (($cl@index+1) is div by $num_cell)}</li>{/if}
                  {/foreach}
                  </ul>
                  • 0
                    {if !empty(category_list)}
                    <ul class="category_list">
                    {*кол-во ячеек в строке*}{$num_cell = 4}
                    {foreach $category_list as $cl}
                    {if $cl@first || ($cl@index is div by $num_cell)}<li>{/if}
                    <a class="name" href="{$cl.url}">
                    {if shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}<div><img src="{shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}" /></div>{/if}
                    <span>{$cl.name}</span></a>
                    {if $cl@last || (($cl@index+1) is div by $num_cell)}</li>{/if}
                    {/foreach}
                    </ul>
                    {/if}
                    • +1
                      badeamare badeamare 1 февраля 2017 11:58 #

                      Вообще осталось на главной только

                      Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 75

  • 1
    badeamare 2 февраля 2017 20:05 # Решение

    Помогите пожалуйста вот полный код:

    {if !empty($category)}
    {if shopWmimageincatPlugin::getCategoryImage($category.id, 'banner')}
    <div><img src="{shopWmimageincatPlugin::getCategoryImage($category.id, 'banner')}" alt="{if $wa->shop && shopWmimageincatPlugin::getCategoryImage($category.id, 'icon')} <img src="{shopWmimageincatPlugin::getCategoryImage($category.id, 'icon')}" style="vertical-align:middle; margin-right:5px;" /> {/if}{$category.name}" title="{$category.description|strip_tags}" /></div>
    {/if}
    {/if}
    {if $category.id}
    {$category_list = $wa->shop->categories($category.id, 1)}
    {else}
    {$category_list = $wa->shop->categories(0, 0)}
    {/if}
    
    <ul class="category_list">
    {*кол-во ячеек в строке*}{$num_cell = 4}
    {foreach $category_list as $cl}
    {if $cl@first || ($cl@index is div by $num_cell)}<li>{/if}
    <a class="name" href="{$cl.url}">
    {if shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}<div><img src="{shopWmimageincatPlugin::getCategoryImage($cl.id, 'image')}" /></div>{/if}
    <span>{$cl.name}</span></a>
    {if $cl@last || (($cl@index+1) is div by $num_cell)}</li>{/if}
    {/foreach}
    </ul>
    
    Сама ошибка! на главной
    
    Notice: Undefined index: category in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 67
    
    Notice: Trying to get property of non-object in /home/u186064174/public_html/wa-cache/apps/shop/templates/compiled/shop_ru_RU/d6/f0/9a/d6f09af08292a3e25cef08b9816689cc9fc42639.file.home.html.php on line 67


    • +1
      badeamare badeamare 2 февраля 2017 20:19 #

      Вторые две строки решил путем добавления

      {if !empty($category.id)}
      {/if}

      Вон тут

      {if !empty($category.id)}
      {if $category.id}
      {$category_list = $wa->shop->categories($category.id, 1)}
      {/if}

Добавить ответ

Чтобы добавить комментарий, зарегистрируйтесь или войдите