Skip to main content

Help with empty cart in multi language site

More
10 years 1 week ago #250991 by MarioMagno
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.

More
10 years 6 days ago #250993 by nicolas
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.

More
10 years 6 days ago - 10 years 6 days ago #251033 by MarioMagno

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: 10 years 6 days ago by MarioMagno.

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

More
10 years 6 days ago #251054 by nicolas
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:
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.

More
10 years 5 days ago #251145 by MarioMagno

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:

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.

More
10 years 5 days ago #251149 by nicolas
Hi,

As I said, you need to replace the name of the button by that code.
So:
Code:
<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.

More
10 years 3 days ago #251283 by MarioMagno
Thank you very much!

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

Time to create page: 0.232 seconds
Powered by Kunena Forum