sm5k Posted November 20, 2013 Share Posted November 20, 2013 (edited) Hi Community, today i got another question where google isn`t going to help. I need to hide the hole basket in the top right of the shop if there are no products in it. There are some topics about doin that in Prestashop 1.4.x but all say its different in Prestashop 1.5.x. I think this could be done by an simple "if / else" case but dunno where to search for. Would be great if someone got an idea. Thx a lot. SM5K Edited November 22, 2013 by sm5k (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted November 20, 2013 Share Posted November 20, 2013 hello you can add simple if condition: {if $products} block-cart.tpl contents here {/if} 1 Link to comment Share on other sites More sharing options...
sm5k Posted November 20, 2013 Author Share Posted November 20, 2013 Hey Vekia, top answering time --> Was exactly what i thaught how this could be done but have no idea where Sorry for beeing dumb Thx SM5k Link to comment Share on other sites More sharing options...
vekia Posted November 20, 2013 Share Posted November 20, 2013 the question is: what you mean by cart? block user info block? or only block which is visible after mouse over? Link to comment Share on other sites More sharing options...
sm5k Posted November 20, 2013 Author Share Posted November 20, 2013 Hey Vekia user info can stay on place But if simpler it can be hidden aswell. I took a screenshot for you. I want to hide the box marked yellow if no produkts selected, and first show up if a produkt is added from any page. TY Link to comment Share on other sites More sharing options...
sm5k Posted November 21, 2013 Author Share Posted November 21, 2013 Hey Vekia, seen what i ment? Any Ideas where to set the if? Thx a lot and have a great day. SM5K Link to comment Share on other sites More sharing options...
vekia Posted November 21, 2013 Share Posted November 21, 2013 in this case it's necessary to modify blockuserinfo module (not block cart) in blockuserinfo.tpl file add this code: {if $cart_qties ==0} <ul id="header_nav"> {if !$PS_CATALOG_MODE} <li id="shopping_cart"> <a href="{$link->getPageLink($order_process, true)|escape:'html'}" title="{l s='View my shopping cart' mod='blockuserinfo'}" rel="nofollow">{l s='Cart' mod='blockuserinfo'} <span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span> <span class="ajax_cart_product_txt{if $cart_qties != 1} hidden{/if}">{l s='Product' mod='blockuserinfo'}</span> <span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='Products' mod='blockuserinfo'}</span> <span class="ajax_cart_total{if $cart_qties == 0} hidden{/if}"> {if $cart_qties > 0} {if $priceDisplay == 1} {assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant} {convertPrice price=$cart->getOrderTotal(false, $blockuser_cart_flag)} {else} {assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant} {convertPrice price=$cart->getOrderTotal(true, $blockuser_cart_flag)} {/if} {/if} </span> <span class="ajax_cart_no_product{if $cart_qties > 0} hidden{/if}">{l s='(empty)' mod='blockuserinfo'}</span> </a> </li> {/if} <li id="your_account"><a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my customer account' mod='blockuserinfo'}" rel="nofollow">{l s='Your Account' mod='blockuserinfo'}</a></li> </ul> {/if} Link to comment Share on other sites More sharing options...
sm5k Posted November 21, 2013 Author Share Posted November 21, 2013 Hey Vekia, Good Job. Kills the CSS but now i got a hook to start work. Thx for your help!!! Greetz SM5K Link to comment Share on other sites More sharing options...
sm5k Posted November 21, 2013 Author Share Posted November 21, 2013 Hey Vekia and Community, i solved the css as well. Will post the css and tpl parts under this post for people who need. But now the problem is that the basket stays hidden until you move to another page or do a refresh. Any Ideas how to solve this? Greetz SM5K _________________________________________________________ blockuserinfo.tpl ____________________________________________ <div id="header_user" {if $PS_CATALOG_MODE}class="header_user_catalog"{/if}> {if $cart_qties !=0} <ul id="header_nav"> {if !$PS_CATALOG_MODE} <li id="shopping_cart"> <a href="{$link->getPageLink($order_process, true)|escape:'html'}" title="{l s='View my shopping cart' mod='blockuserinfo'}" rel="nofollow">{l s='Cart' mod='blockuserinfo'} <span class="ajax_cart_quantity{if $cart_qties == 0} hidden{/if}">{$cart_qties}</span> <span class="ajax_cart_product_txt{if $cart_qties != 1} hidden{/if}">{l s='Product' mod='blockuserinfo'}</span> <span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='Products' mod='blockuserinfo'}</span> <span class="ajax_cart_total{if $cart_qties == 0} hidden{/if}"> {if $cart_qties > 0} {if $priceDisplay == 1} {assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant} {convertPrice price=$cart->getOrderTotal(false, $blockuser_cart_flag)} {else} {assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant} {convertPrice price=$cart->getOrderTotal(true, $blockuser_cart_flag)} {/if} {/if} </span> <span class="ajax_cart_no_product{if $cart_qties > 0} hidden{/if}">{l s='(empty)' mod='blockuserinfo'}</span> </a> </li> {/if} <li id="your_account"><a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my customer account' mod='blockuserinfo'}" rel="nofollow">{l s='Your Account' mod='blockuserinfo'}</a></li> </ul> {/if} {if $cart_qties ==0} <div id="headspace"></div> {/if} _________________________________________________________ blockuserinfo.css ____________________________________________ #headspace{height:40px;} Link to comment Share on other sites More sharing options...
vekia Posted November 21, 2013 Share Posted November 21, 2013 it will be necessary to do it a bit different. instead of {if $cart_qties !=0} <ul id="header_nav"> ... ... {/if} use this: <ul id="header_nav" {if $cart_qties ==0}style="display:none;"{/if}> then in ajax-cart.js (blockcart/ajax-cart.js) add code $("#header_nav").show(); before this: var $element = $(callerElement).parent().parent().find('a.product_image img,a.product_img_link img'); Link to comment Share on other sites More sharing options...
sm5k Posted November 22, 2013 Author Share Posted November 22, 2013 Hey Vekia, GODLIKE! - Works as needed! Thx a lot. Enjoy the Weekend. Greetz SM5K I remark the topic as solved now. 1 Link to comment Share on other sites More sharing options...
vekia Posted November 24, 2013 Share Posted November 24, 2013 hello sorry for my late reply, is there any chance to see it live? im so curious how it works in real shop 1 Link to comment Share on other sites More sharing options...
Recommended Posts