Jump to content

[SOLVED]who can explain me this code founded on pretsashop module ?


jemmeli
 Share

Recommended Posts

hello everybody

 

when i was surfing the module special of prestashop I found the next code :

 

<input type="radio" name="always_display" id="display_on" value="1" '.(Tools::getValue('always_display', Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) ? 'checked="checked" ' : '').'/>

 

it is clear that the code is a code for a radio button but the portion that i did not understood is related to the tast one after the attribute value :

 

(Tools::getValue('always_display', Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) ? 'checked="checked" ' : '')

 

what does it mean this portion ?

Share this post


Link to post
Share on other sites

this is shorthand if condition.

 

Tools::getValue('always_display') - this code return information about value of always_display field, if it is checked - returns 1 if not, returns null

 

Configuration::get('PS_BLOCK_SPECIALS_DISPLAY') - value stored in configuration table, returns database setting value (1 or null)

 

 

'checked="checked" ' : ''

 

if tools::getValue('always_display') == Configuration('PS_BLOCK_SPECIALS_DISPLAY') then script will write 'checked="checked"'

 

if not will write nothing - ''

  • Like 1

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More