Help with empty cart in multi language site

  • Posts: 14
  • Thank you received: 0
8 years 1 month ago #250991

Hello everyone,
my compliments for support team.
I have one issue to submit to all of you:
I've inserted a code:
<input type="submit" class="button" name='EMPTY_CART' value="Svuota carrello" onclick="window.location='<?php echo hikashop::completeLink('product&task=cleancart&return_url='. urlencode(base64_encode('index.php?lang=it'))); ?>';return false;"/>.

and works.

But I have a multilanguage site. So, in this way I do not have a different sentences (Empty cart) in all of languges.

Can you hel me please?
Thanks in advance

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
8 years 1 month ago #250993

Hi,

You need to change the piece:
<?php echo hikashop::completeLink('product&task=cleancart&return_url='. urlencode(base64_encode('index.php?lang=it'))); ?>

to:
<?php $lang = JFactory::getLanguage(); $locale=strtolower(substr($lang->get('tag'),0,2)); echo hikashop::completeLink('product&task=cleancart&return_url='. urlencode(base64_encode('index.php?lang='.$locale))); ?>

Please Log in or Create an account to join the conversation.

  • Posts: 14
  • Thank you received: 0
8 years 1 month ago #251033

nicolas wrote: Hi,

You need to change the piece:
<?php echo hikashop::completeLink('product&task=cleancart&return_url='. urlencode(base64_encode('index.php?lang=it'))); ?>

to:
<?php $lang = JFactory::getLanguage(); $locale=strtolower(substr($lang->get('tag'),0,2)); echo hikashop::completeLink('product&task=cleancart&return_url='. urlencode(base64_encode('index.php?lang='.$locale))); ?>


Hi Nicolas,
thanks for your quick reply, but unfortunately it doesn't work.
It shown always the same label "Empty Cart" in all languages (maybe caused from input string: input type="submit" class="button" name='EMPTY_CART' value="Svuota carrello" ... )?

Thanks
Mario

Last edit: 8 years 1 month ago by MarioMagno.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
8 years 1 month ago #251054

I thought that the issue was with the lang parameter not the name of the button.

For the name of the button, you can use such code:

<?php echo JText::_('EMPTY_CART'); ?>
And then add a translation override :
EMPTY_CART="Empty cart"
www.hikashop.com/download/languages.html#modify

Please Log in or Create an account to join the conversation.

  • Posts: 14
  • Thank you received: 0
8 years 1 month ago #251145

nicolas wrote: I thought that the issue was with the lang parameter not the name of the button.

For the name of the button, you can use such code:

<?php echo JText::_('EMPTY_CART'); ?>
And then add a translation override :
EMPTY_CART="Empty cart"
www.hikashop.com/download/languages.html#modify


Ok, but where can I write the piece of code you mentioned?
Maybe I can write like this:

<?php echo JText::_('EMPTY_CART'); ?>
<?php $lang = JFactory::getLanguage(); $locale=strtolower(substr($lang->get('tag'),0,2)); echo hikashop::completeLink('product&task=cleancart&return_url='. urlencode(base64_encode('index.php?lang='.$locale))); ?>

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13378
  • MODERATOR
8 years 1 month ago #251149

Hi,

As I said, you need to replace the name of the button by that code.
So:

<input type="submit" class="button" name='<?php echo JText::_('EMPTY_CART'); ?>' value="<?php echo JText::_('EMPTY_CART'); ?>" onclick="window.location='<?php $lang = JFactory::getLanguage(); $locale=strtolower(substr($lang->get('tag'),0,2)); echo hikashop::completeLink('product&task=cleancart&return_url='. urlencode(base64_encode('index.php?lang='.$locale))); ?>';return false;"/>.

Please Log in or Create an account to join the conversation.

  • Posts: 14
  • Thank you received: 0
8 years 1 month ago #251283

Thank you very much!

Please Log in or Create an account to join the conversation.

Time to create page: 0.070 seconds
Powered by Kunena Forum