Error in tpl file or php version is wrong - cs-cart

I try to find similar problem like mine but seems no luck. I have cs-cart multivendor with php7.1 tested with normal theme work fine but when i install new theme site working until i login on admin panel. So that means after my login on admin panel site goes in white screen. I try to figure and i see in my theme folder index.tpl file always getting empty. So to site to work again I have to replace the index.tpl file again. Here is the code of the index.tpl file. Can u please tell me if there is some error in file who doing site to go down? Thank you!
{capture name="page_title"} {hook name="index:title"} {if
$page_title}
{$page_title} {else}
{if $language_direction == "rtl"}
{foreach from=$breadcrumbs|#array_reverse item=i name="bkt"}
{if !$smarty.foreach.bkt.last}{if !$smarty.foreach.bkt.last && !$smarty.foreach.bkt.first} ::
{/if}{$i.title|strip_tags}{/if}
{/foreach}
{else}
{foreach from=$breadcrumbs item=i name="bkt"}
{if !$smarty.foreach.bkt.first}{$i.title|strip_tags}{if !$smarty.foreach.bkt.last} :: {/if}{/if}
{/foreach}
{/if}
{if !$skip_page_title && $location_data.title}{if $breadcrumbs|count > 1} - {/if}{$location_data.title}{/if} {/if}
{/hook} {/capture} {$smarty.capture.page_title|strip|trim
nofilter} {include file="meta.tpl"} {hook name="index:links"}
{/hook} {include file="common/styles.tpl" include_dropdown=true} {if "DEVELOPMENT"|defined && $smarty.const.DEVELOPMENT == true}
window.jsErrors = [];
window.onerror = function(message, source, lineno, colno, error) {
var verboseMessage = message;
if (source) {
verboseMessage = source + '#' + lineno + ':' + colno + "\n\n" + message;
}
console.error(verboseMessage);
if (error && error.stack) {
console.log(error.stack);
}
document.write('<pre data-ca-debug="1" style="border: 2px solid red; margin: 2px;">'
+ verboseMessage + "\n\n"
+ (error && error.stack ? error.stack : '')
+ '</pre>'
); }; </script> <!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.1.9/es5-shim.min.js"></script><![endif]-->
{/if} {hook name="index:head_scripts"}{/hook}
{hook name="index:body"}
{if $runtime.customization_mode.design}
{include file="common/toolbar.tpl" title=("on_site_template_editing")
href="customization.disable_mode?type=design"}
{/if}
{if $runtime.customization_mode.live_editor}
{include file="common/toolbar.tpl" title=("on_site_live_editing")
href="customization.disable_mode?type=live_editor"}
{/if}
{if "THEMES_PANEL"|defined && !$runtime.customization_mode.live_editor}
{include file="demo_theme_selector.tpl"}
{/if}
<div class="ty-tygh {if $runtime.customization_mode.theme_editor}te-mode{/if} {if
$runtime.customization_mode.live_editor ||
$runtime.customization_mode.design ||
$smarty.const.THEMES_PANEL}ty-top-panel-padding{/if}"
id="tygh_container">
{include file="common/loading_box.tpl"}
{include file="common/notification.tpl"}
<div class="ty-helper-container" id="tygh_main_container">
{hook name="index:content"}
{hook name="index:et_content"}{/hook}
{/hook}
<!--tygh_main_container--></div>
{hook name="index:footer"}{/hook}
<!--tygh_container--></div>
{include file="common/scripts.tpl"}
{if $runtime.customization_mode.design}
{include file="backend:common/template_editor.tpl"}
{/if}
{if $runtime.customization_mode.theme_editor}
{include file="backend:common/theme_editor.tpl"}
{/if}
{/hook} </body>

Please check your license for the theme you are using

Related

CS Cart - Show Three Level of Categories on Catalog and Top Category Page

For CS-Cart Multivendor, Version 4.15.2
How can we display 6 Sub-Categories-Level-1 and 3 Sub-Categories-Level-2 on mydomain.com/catalog page, similar to https://my.indiamart.com/ or https://dir.indiamart.com/
Then how to display 5 Sub-Categories-Level-1 image and name as displayed on https://dir.indiamart.com/
How can we display All Sub-Categories-Level-1 and 5 SubCategories-Level-2 on individual Category Page like below along with Level-1 and Level-2 Images
https://dir.indiamart.com/industry/builders-hardware.html
Finally Display SubCatetory-Level-2 and All Sub-Category-Level3 like
enter link description here
I think there is some modification required in views\categories\catalog.tpl and categories\components\subcategories.tpl.
Also some HTML and css related help is highly appreciated for user friendly view on all devices.
Thanks.
categories_multicolumns.tpl
{split data=$categories size=$columns|default:"3" assign="splitted_categories"}
{strip}
{foreach from=$splitted_categories item="scats"}
{foreach from=$scats item="category"}
{if $category}
{$href=$category|fn_form_dropdown_object_link:$block.type}
{if $category.main_pair}
{include file="common/image.tpl"
show_detailed_link=false
images=$category.main_pair
no_ids=true
image_id="category_image"
image_width=$settings.Thumbnails.category_lists_thumbnail_width
image_height=$settings.Thumbnails.category_lists_thumbnail_height
class="ty-subcategories-img"
}
{/if}
{$category.category}
{/if}
{/foreach}
{/foreach}
{/strip}
{capture name="mainbox_title"}{$title}{/capture}
subcategories.tpl
{if $subcategories}
{math equation="ceil(n/c)" assign="rows" n=$subcategories|count c=$columns|default:"3"}
{split data=$subcategories size=$rows assign="splitted_subcategories"}
<ul class="subcategories clearfix">
{hook name="categories:view_subcategories"}
{foreach from=$splitted_subcategories item="ssubcateg"}
{foreach from=$ssubcateg item=category name="ssubcateg"}
{if $category}
<li class="ty-subcategories__item">
<a href="{"categories.view?category_id=`$category.category_id`"|fn_url}">
{if $category.main_pair}
{include file="common/image.tpl"
show_detailed_link=false
images=$category.main_pair
no_ids=true
image_id="category_image"
image_width=$settings.Thumbnails.category_lists_thumbnail_width
image_height=$settings.Thumbnails.category_lists_thumbnail_height
class="ty-subcategories-img"
}
{/if}
<span {live_edit name="category:category:{$category.category_id}"}>{$category.category}</span>
</a>
</li>
{/if}
{/foreach}
{/foreach}
{/hook}
</ul>
{/if}

Hide display if empty data

I'd like to display info when there is info in my description.
I need to hide the whole thing when there's no info
{if !empty($product.description-short) }
<span class="label" style="text-decoration:underline">
{l s='Information:' d='Shop.Theme.Catalog'}</span>
{$product.description_short nofilter}
{/if}
Problem : Even when there are info, nothing will display
In your if statement you check for description-short and try to display description_short.
Should be:
{if !empty($product.description_short) }
<span class="label" style="text-decoration:underline">
{l s='Information:' d='Shop.Theme.Catalog'}</span>
{$product.description_short nofilter}
{/if}

Prestashop, display information in function of product ID

I use Prestashop 1.4 (for requirements of a client) but I need to use a css class in function of the ID of a product.
I try this :
<header class="header {if $page_name == 'index' || $page_name == 'product' && $product->id_product== 2}transparent{/if}">
</header>
But that's don't work. I try to get the subcategory #2 from home category. Any idea please ?
Try :
<header class="header {if ($page_name == 'index' || $page_name == 'product') && $marty.get.id_product== 2}transparent{/if}">
</header>

Check a string in Smarty

I have a problem with smarty framework, so I need to verify if an image name starts with 'http':
I try this code:
{foreach from=$video->result() item=v}
{if substr($v->image,0,4) eq 'http'}
<img src="{$v->image}" alt="">
{else}
<img src="{$IMG_URL}videos/images/{$v->date|date_format:'%Y'}/{$v->date|date_format:'%m'}/{$v->image}" alt="">
{/if}
{/foreach}
Help me please..Exists another way?
This code should work fine. Probably your data is not set properly.
Consider the following testing code:
PHP file:
class V {
public $image = 'http://rwewreuiuiwre';
}
$smarty->assign('v', new V());
Template file:
{if substr($v->image,0,4) eq 'http'}
http
{else}
non http
{/if}
It works fine. If you change $image to hxttp you get non http message

How to show content of a a specific URL in Smarty template?

Following is my code snippet from smarty template :
<div id="entrancelist">
<h2 class="heading">My Packages</h2>
{if $user_study_test_packages.test}
<ul class="entrancelist">
{foreach from=$user_study_test_packages.test item="user_test_packages" key=key}
<li>
<h4>{$user_test_packages.pack_name|capitalize:true}</h4>
{if $user_test_packages.pack_expiry_date1 >= $current_date }
<div class="fr"><span class="expiry">Expiry : {$user_test_packages.pack_expiry_date}</span></div>
{else}
<div class="fr"><span class="expiry_dt">This package is expired on {$user_test_packages.pack_expiry_date}.</span></div>
{/if}
<p class="descp">{$user_test_packages.test_pack_desc}</p>
<div class="srtest"> </div>
</li>
{/foreach}
</ol>
{else}
You haven't bought any online test packages
{/if}
</div>
Now what I want to do is reaplace the text "You haven't bought any online test packages" with the content of different URL say www.google.com But I'm not understanding how should I achieve this. Can anyone help me out in this issue? Thanks in advance.
Why not keep PHP separate from the template?
Maybe do this in your php code,
<?php
$gcontent = file_get_contents('http://www.google.com');
$smarty->assign('gcontent',$gcontent);
?>
Then you can use {$gcontent} in your template.
You can even use query string parameters with the URL if you wanted to. More info on the php function.
http://www.w3schools.com/php/func_filesystem_file_get_contents.asp
Something like this works for me in Smarty 3, but some might not consider it very elegant:
...
{else}
{file_get_contents('http://www.google.com/')}
{/if}

Resources