Jump to content

[SOLVED] Join two strings using Smarty


prestatent

Recommended Posts

 

Fixed it now.

Added to product.js on theme the following line beginning with $('a style="color:

if (!selectedCombination['unavailable'])
{
   $('#availability_value').text(doesntExistNoMore + (globalQuantity > 0 ? ' ' + doesntExistNoMoreBut : '')).addClass('warning_inline');
   $('<a style="color: #ee7624; text-decoration: underline;" href="/stores">here</a>').appendTo('#availability_value');
}    
else
{
   $('#availability_value').text(doesntExistNoMore).addClass('warning_inline');
   $('#oosHook').hide();
}

 

Prestashop 1.5.4.1

 

Hi

 

I'm trying to do something which in theory should simple. I want to add a link into the message on the product page when a product is out of stock. For example the text of the current message shows the following:

 

"This product is no longer in stock with those attributes but is available with others".

 

I would like to change this to:

 

"This product is no longer in stock with those attributes but is available from our stockists here .http://www.mysite.com/stockists"

 

It would be great if anyone can help out.

 

Thanks.

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

Thanks for your reply.

 

I have tried this but unfortunately can't get this to work. The code before changing is:

 

var doesntExistNoMoreBut = '{l s='with those attributes but is available with others' js=1}';

 

How can I add this variable:

 

var stocklink = '<a href="{$base_dir}/stockists">here</p>';

 

to the above variable "doesntExistNoMoreBut".

 

I've tried this:

 

var doesntExistNoMoreBut = '{l s='with those attributes but is available with others' js=1}' '{$stocklink}';

 

but no joy.

 

Any ideas?
 



 

Link to comment
Share on other sites

There is no need to use smarty to join those 2 javascript variables

 

You are fine with your new statement to define your stock link

var stocklink = '<a href="{$base_dir}/stockists">here</p>';

Then just add a second line that joins your 2 javascript variables

doesntExistNoMoreBut = doesntExistNoMoreBut.concat(stocklink);
Link to comment
Share on other sites

Fixed it now.

Added to product.js on theme the following line beginning with $('a style="color:

if (!selectedCombination['unavailable'])
{
   $('#availability_value').text(doesntExistNoMore + (globalQuantity > 0 ? ' ' + doesntExistNoMoreBut : '')).addClass('warning_inline');
   $('<a style="color: #ee7624; text-decoration: underline;" href="/stores">here</a>').appendTo('#availability_value');
}    
else
{
   $('#availability_value').text(doesntExistNoMore).addClass('warning_inline');
   $('#oosHook').hide();
}

Edited by prestatent (see edit history)
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...