Jump to content

How to add a word "Item" or "Items" next to quantity in the cart block


Recommended Posts

Hello,


 


I have some little issues with my cart block on the top of the site page.


 


I want to add a text like Item or Items ( depending from quantity) next to quantity of cart in the cart block.


 


As far as I can understand, the modifications should be made in blockuserinfo.tpl ( please find below)


 


Currently I have what is on picture 1 and 2.


 


I want it to be like on picture 3 and 4.


 


And, also, I think there's some problems with javascript because when i reload the page or choose other page, it shows empty ( like in picture 5) for 1-2 seconds and then only the cart quantity( like in picture 1 and 2).


 


How can be this issues be resolved ?


 


I will really appreciate your help.


 


Thank you in advance.



{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}

<!-- Block user information module HEADER -->
<section class="blockuserinfo header-box">
{if $logged}
<a href="{$link->getPageLink('index', true, NULL, "mylogout")}" title="{l s='Log out' mod='blockuserinfo'}" class="logout" rel="tooltip" data-placement="bottom" data-original-title="first tooltip"><span><i class="icon-unlock"></i></span></a>
{else}
<a href="{$link->getPageLink('my-account', true)}" title="{l s='Login' mod='blockuserinfo'}" class="login" rel="tooltip" data-placement="bottom" data-original-title="first tooltip" ><span><i class="icon-lock"></i></span></a>
{/if}
</section>

<section id="header_user" class="blockuserinfo-cart header-box">
{if !$PS_CATALOG_MODE}
<div id="shopping_cart">
<a href="{$link->getPageLink($order_process, true)}" title="{l s='View my shopping cart' mod='blockuserinfo'}" rel="nofollow">
<i class="opancart icon-double-angle-down"></i>
<span class="shopping_cart_title">{l s='Cart' mod='blockuserinfo'}</span>
<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="price 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>
</div>
{/if}
</section>

post-469651-0-25615500-1400486335_thumb.jpg

post-469651-0-14844100-1400486341_thumb.jpg

post-469651-0-81825300-1400486351_thumb.jpg

post-469651-0-27162800-1400486357_thumb.jpg

post-469651-0-09461400-1400486368_thumb.jpg

Link to comment
Share on other sites

              <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-->

why these two lines are commented out?

this line contains "product" and "products" words (depending on number of products in cart)

you have to translate it in back office to "item" and "items"

 

localization > translation > front office translations

 

and uncomment it first!

Link to comment
Share on other sites

I'm using localhost and get: " Warning! Your PHP configuration limits the maximum number of fields allowed in a form: 1000 for max_input_vars. Please ask your hosting provider to increase this limit to 1395 at least, or you will have to edit the translation files."  message,

 

Can required modification be made in blockuserinfo.tpl ? What do you mean saying to first uncomment it? 

 

Thanks for help !

Edited by armenak (see edit history)
Link to comment
Share on other sites

yes, you can change it in file you mentioned.

uncomment lines that i mentioned and change:

{l s='Product' mod='blockuserinfo'}

to

{l s='Item' mod='blockuserinfo'}

and:

{l s='Products' mod='blockuserinfo'}

to:

{l s='Items' mod='blockuserinfo'}
Link to comment
Share on other sites

 <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>

I just removed unnecessary "!" and "-"  signs like above ( this corresponds to uncommenting, right?). But this hasn't helped? Now when reloading s page  I have a "Product" text for a while which after disappears and only quantity ( number) is shown.

Edited by armenak (see edit history)
Link to comment
Share on other sites

I changed the code to this: 

                <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='Item' mod='blockuserinfo'}</span>
                <span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='Items' mod='blockuserinfo'}</span>
                 {*<span class="price ajax_cart_total{if $cart_qties == 0} hidden{/if}">
				{if $cart_qties > 0}
					{if $priceDisplay == 1}

But this didn't help. When reloading site pageI have "item" word for a while which dissapears and quality is shown ( like before).

Link to comment
Share on other sites

your website probably has some ajax query in backgrund.

due to the fact that this is probably not default theme - please share url, i have to inspect it.

 

it's not default behaviour for standard theme.

Link to comment
Share on other sites

there is an ajax query:

1ieU3ty.pngit contains response:

q46YMdY.png

 

 

so it changes your cart block.

 

try to rename class=""

of:

                <span class="ajax_cart_product_txt{if $cart_qties != 1} hidden{/if}">{l s='Item' mod='blockuserinfo'}</span>
                <span class="ajax_cart_product_txt_s{if $cart_qties < 2} hidden{/if}">{l s='Items' mod='blockuserinfo'}</span>

just use something different than ajax_cart_product_txt

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...