Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento : Variable well displayed in javascript. How call it in php in the same file?
    primarykey
    data
    text
    <p>I've built one variable (horaires_lundi) in this file :</p> <blockquote> <p>app/code/community/Unirgy/StoreLocator/controllers/Adminhtml/Locationcontroller.php</p> </blockquote> <pre><code>-&gt;setTitle($this-&gt;getRequest()-&gt;getParam('title')) -&gt;setNotes($this-&gt;getRequest()-&gt;getParam('notes')) -&gt;setStreetAddress($this-&gt;getRequest()-&gt;getParam('street_address')) -&gt;setHorairesLundi($this-&gt;getRequest()-&gt;getParam('horaires_lundi')) </code></pre> <p>All variables are well displayed in JavaScript in this file :</p> <blockquote> <p>app/design/frontend/default/default/template/unirgy/storelocator/map.phtml</p> </blockquote> <pre><code>(function(){ var storeLocator = new UnirgyStoreLocator({ mapEl: $('map'), sidebarEl: $('sidebar'), searchUrl: '&lt;?php echo $this-&gt;getUrl('ustorelocator/location/search')?&gt;', generateSidebarHtml: function(m) { return '&lt;span style="font-size:14px; color:#C68804;"&gt;&lt;b&gt;' + m.title + '&lt;/b&gt;&lt;/span&gt;&lt;br/&gt;(Distance : ' + parseFloat(m.distance).toFixed(1) + ' ' + m.units + ')&lt;br/&gt;' + m.street_address + '&amp;nbsp;' + m.test + '&amp;nbsp;' + m.city + '&lt;br/&gt;&lt;b&gt;' + m.notes + '&lt;/b&gt;&lt;br/&gt;'; }, generateMarkerHtml: function(m) { var url = m.website_url.replace(/\s/,''); var dataForm = new VarienForm('form-validate', true); return '&lt;span style="font-size:14px; color:#C68804;"&gt;' + m.title + '&lt;/span&gt;&lt;br/&gt;' + '&lt;?php if (trim($this-&gt;getHorairesLundi())!=""): ?&gt;Lun&amp;nbsp;'+ m.horaires_lundi +'&lt;?php else : ?&gt;No horaire lundi&lt;br/&gt;&lt;?php endif; ?&gt;' </code></pre> <p>variable <code>m.horaires_lundi</code> in JavaScript is well displayed in frontend. But I can't make a condition in PHP to display <code>m.horaires_lundi</code> only if <code>m.horaires_lundi</code> exists...</p> <p>Above I made a try with </p> <pre><code>&lt;?php if (trim($this-&gt;getHorairesLundi())!=""): ?&gt; </code></pre> <p>Is it a goog method? what else must I do? Is there an other method with something like:</p> <pre><code>&lt;?php if (Mage::helper(... </code></pre> <p>I've found a tutorial about Magento but can't find my solution.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload