Post by LeorLindel » Sun Mar 03, 2013 3:14 am

How in the mini cart that is in the header to replace text:

1) For O item
0 item(s) - $ 0 (what is currently)
by:
No item

2) For 1 item
1 Item(s) - $ 100 (what is currently)
by:
1 Item - $ 100

3) For x items
x item(s) - $ 250 (what is currently)
by:
x items - $ 250

In catalog/controller/module/cart.php

I added

Code: Select all

$ this-> data ['text_no_item'] = $ this-> language-> get ('text_no_item');
$ this-> data ['text_one_item'] = $ this-> language-> get ('text_one_item');
I added these variables in the language files with correspondence.

In the file catalog/view/theme/default/template/module/cart.tpl

How should I change this code:

Code: Select all

  <div class="heading">
    <h4><?php echo $heading_title; ?></h4>
    <a><span id="cart-total"><?php echo $text_items; ?></span></a></div>
Thank's.

Tous les packs de langues Française depuis la v1.4.7 et toutes les versions intégrales 100 % Français sont disponibles sur le Portail Officiel Français.

Image


User avatar
Active Member

Posts

Joined
Mon Feb 22, 2010 8:05 pm

Post by uksitebuilder » Sun Mar 03, 2013 4:06 am

edit: catalog/language/english/module/cart.php

Change

Code: Select all

$_['text_items']    = '%s item(s) - %s';
to

Code: Select all

$_['text_items']    = '%s items - %s';

edit: catalog/controller/module/cart.php

find

Code: Select all

$this->data['text_items'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
change to

Code: Select all

if($this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0)==0){
    $this->data['text_items'] = $this->data['text_no_item'] . ' - ' . $this->currency->format($total);
}elseif($this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0)==1){
    $this->data['text_items'] = '1 ' . $this->data['text_one_item'] . ' - ' . $this->currency->format($total);
}else{
    $this->data['text_items'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
}
Also need to edit

catalog/controller/checkut/cart.php

find

Code: Select all

$json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
change to

Code: Select all

if($this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0)==0){
    $json['total'] = $this->data['text_no_item'] . ' - ' . $this->currency->format($total);
}elseif($this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0)==1){
    $$json['total'] = '1 ' . $this->data['text_one_item'] . ' - ' . $this->currency->format($total);
}else{
    $json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
}

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by LeorLindel » Sun Mar 03, 2013 4:33 am

Thank's

This works but only in part, because the correct text is displayed when you click on the arrow and not when you add an item.

Add to cart
mini-cart00.png

mini-cart00.png (13.7 KiB) Viewed 5407 times

Click on arrow or text
mini-cart01.png

mini-cart01.png (24.42 KiB) Viewed 5407 times


Tous les packs de langues Française depuis la v1.4.7 et toutes les versions intégrales 100 % Français sont disponibles sur le Portail Officiel Français.

Image


User avatar
Active Member

Posts

Joined
Mon Feb 22, 2010 8:05 pm

Post by uksitebuilder » Sun Mar 03, 2013 4:54 am

edited my code above to add a missing file change that is needed.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by LeorLindel » Sun Mar 03, 2013 5:07 am

This is what I "ve done

catalog/controller/module/cart.php

I replace

Code: Select all

		$this->data['text_items'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
		$this->data['text_empty'] = $this->language->get('text_empty');
by

Code: Select all

		$this->data['text_no_item'] = $this->language->get('text_no_item');
		$this->data['text_one_item'] = $this->language->get('text_one_item');
			if($this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0)==0){
		$this->data['text_items'] = $this->data['text_no_item'];
			} elseif($this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0)==1){
		$this->data['text_items'] = '1' . ' ' . $this->data['text_one_item'] . ' - ' . $this->currency->format($total);
			}else{
		$this->data['text_items'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
		}
In catalog/language/english/module/cart.php

I replace

Code: Select all

$_['text_items']    = '%s item(s) - %s';
by

Code: Select all

$_['text_no_item']	= 'No item';
$_['text_one_item']	= 'item';
$_['text_items']    = '%s items - %s';
Last edited by LeorLindel on Sun Mar 03, 2013 5:21 am, edited 1 time in total.

Tous les packs de langues Française depuis la v1.4.7 et toutes les versions intégrales 100 % Français sont disponibles sur le Portail Officiel Français.

Image


User avatar
Active Member

Posts

Joined
Mon Feb 22, 2010 8:05 pm

Post by uksitebuilder » Sun Mar 03, 2013 5:20 am

you also need to do the last part of my post above

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by LeorLindel » Sun Mar 03, 2013 5:36 am

In addition to the changes I mentioned above, so I replaced

In catalog/controller/checkout/cart.php

This line:

Code: Select all

				$json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
By this lines:

Code: Select all

				if($this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0)==0){
					$json['total'] = $this->data['text_no_item'] . ' - ' . $this->currency->format($total);
				}elseif($this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0)==1){
					$$json['total'] = '1 ' . $this->data['text_one_item'] . ' - ' . $this->currency->format($total);
				}else{
					$json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
				}
Does not work when adding the first item

Tous les packs de langues Française depuis la v1.4.7 et toutes les versions intégrales 100 % Français sont disponibles sur le Portail Officiel Français.

Image


User avatar
Active Member

Posts

Joined
Mon Feb 22, 2010 8:05 pm

Post by uksitebuilder » Sun Mar 03, 2013 6:07 am

and also the language file: catalog/language/english/checkout/cart.php

You need to add your language additions.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by LeorLindel » Sun Mar 03, 2013 6:20 am

So I replaced

In catalog/language/english/checkout/cart.php

This line:

Code: Select all

$_['text_items']             = '%s item(s) - %s';
By this lines:

Code: Select all

$_['text_no_item']			 = 'No item';
$_['text_one_item']			 = 'item';
$_['text_items']			 = '%s items - %s';
Everything works except when it is the first item in your cart, the text is displayed. This appears when you add to cart the second article or when click on arrow or the text.

Tous les packs de langues Française depuis la v1.4.7 et toutes les versions intégrales 100 % Français sont disponibles sur le Portail Officiel Français.

Image


User avatar
Active Member

Posts

Joined
Mon Feb 22, 2010 8:05 pm

Post by uksitebuilder » Sun Mar 03, 2013 6:35 am

I will investigate further and reply tomorrow with an answer

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by LeorLindel » Sun Mar 03, 2013 6:41 am

You're right, it's late for me too.
Thank you again for all the time that thou hast spent.
Once this problem is solved, I will make a vQmod XML file that I put at the disposal of members.

Best regard.

Tous les packs de langues Française depuis la v1.4.7 et toutes les versions intégrales 100 % Français sont disponibles sur le Portail Officiel Français.

Image


User avatar
Active Member

Posts

Joined
Mon Feb 22, 2010 8:05 pm

Post by LeorLindel » Sun Mar 03, 2013 8:59 am

Point of clarification:
For the first article, when you click on the button "Add to cart" headband notification does not appear and the text remains the same, namely "No item". When you click a second time on the button "Add to cart", the notification is displayed and the text "2 items - $(price)".
As mentioned above, if we add a first item in your cart, the text does not change, (No item). It only changes if you click on the arrow or the text for the opening of mini cart and the amended text appears.
Aside from that, everything else works fine, the text change is a result of many changes (add, remove, delete, etc ...)

PS: The XML file for vQmod is ready (almost, it remains that this concern)
Moreover, here, it may be useful to make the changes. I tested now on v1.5.4.
And again, sorry for my bad english.

Tous les packs de langues Française depuis la v1.4.7 et toutes les versions intégrales 100 % Français sont disponibles sur le Portail Officiel Français.

Image


User avatar
Active Member

Posts

Joined
Mon Feb 22, 2010 8:05 pm

Post by bob.smith.hull » Mon Nov 11, 2013 2:07 am

Hi,

Thanks for your efforts with this. Did anyone manage to get the first added product to update the cart summary in the header?

I agree it works perfect (using 1.5.5.6) except for the first product added to the cart, which doesn't update the header cart summary until you hover over it.

Thanks again :)


Posts

Joined
Sun Nov 10, 2013 10:09 pm

Post by gtoc » Mon Nov 03, 2014 1:03 pm

Bump.. to see if anyone has worked out the first item problem?

New member

Posts

Joined
Tue Apr 23, 2013 12:11 pm

Post by SXGuy » Mon Nov 03, 2014 4:22 pm

Seems like its probably the jquery function not updating the cart until you add another item or press the arrow.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am
Who is online

Users browsing this forum: No registered users and 17 guests