komodityagro Posted May 17, 2013 Share Posted May 17, 2013 It is possible that a block for example suppliers appears for customer till after registration or authentication? Link to comment Share on other sites More sharing options...
vekia Posted May 17, 2013 Share Posted May 17, 2013 You want to disable this block for unlogged users? i understood you well? Link to comment Share on other sites More sharing options...
komodityagro Posted May 20, 2013 Author Share Posted May 20, 2013 Yes, I want to disable a block for unlogged users... Link to comment Share on other sites More sharing options...
vekia Posted May 20, 2013 Share Posted May 20, 2013 Yes, I want to disable a block for unlogged users... okay, now it's clear for me what you exactly expect :-) I've got last questions: what prestashop version you use? this is very important question, because everything depends on this Link to comment Share on other sites More sharing options...
komodityagro Posted May 20, 2013 Author Share Posted May 20, 2013 I use PS 1.5.4.0 Link to comment Share on other sites More sharing options...
vekia Posted May 20, 2013 Share Posted May 20, 2013 to achieve this you have to use context object: {assign var=context value=Context::getContext()} then use simple if condition: {if $context->customer->logged==1} BLOCK HERE {/if} Link to comment Share on other sites More sharing options...
komodityagro Posted May 20, 2013 Author Share Posted May 20, 2013 And have I add it to .tpl file? Link to comment Share on other sites More sharing options...
vekia Posted May 20, 2013 Share Posted May 20, 2013 yes, for example, if you want to disable suppliers for unlogged users, open the: modules/blocksupplier/blocksupplier.tpl file (remember that this file may exists also in themes/modules/blocksupplier/blocksupplier.tpl - if so - you have to append changes there) the first line of the code looks like: <!-- Block suppliers module --> <div id="suppliers_block_left" class="block blocksupplier"> instead code above use this: <!-- Block suppliers module --> {assign var=context value=Context::getContext()} {if $context->customer->logged==1} <div id="suppliers_block_left" class="block blocksupplier"> as you can see - i added the context variable {assing var=context ...} and if condition: {if $context-> ...} at the end of the file add close {/if} condition tag: {/if} <!-- /Block suppliers module --> Link to comment Share on other sites More sharing options...
komodityagro Posted May 20, 2013 Author Share Posted May 20, 2013 Thanks, it works perfect...!!! Link to comment Share on other sites More sharing options...
vekia Posted May 20, 2013 Share Posted May 20, 2013 awesome :-) Im really glad that i could help you i marked this thread as solved if you've got any other questions related to this thread - feel free to continue discussion here regards Link to comment Share on other sites More sharing options...
Recommended Posts