I´m working with Prestashop and I´m displaying prices with 4 decimals because I´m accepting EUR and Bitcoins. This is the code where the price is loaded:
<span class="price"><?php echo $product['price']; ?></span>
Is it possible to set the last 2 decimals to display:none?
If you are using Prestashop you should be editing a TPL file. If that's correct you should not use echo inside TPL. You can use this function:
<span class="price">{convertPrice price=$product.price}</span>
Or just use round PHP function and specify decimal precision:
<span class="price">{round($product.price, 2)}</span>
In javascript you can use Math.round() function. More info here: Round 2 decimals JS
There is no way to hide decimals partially.
Good luck.
There is a module in PrestaShop Addons, so you can define decimals by currency. For example, you can define 2 decimals for EUR and 4 decimals for Bitcoins.
The link of the module in the Addons :
https://addons.prestashop.com/en/price-management/28731-number-of-decimals-for-price-by-currency.html
Related
I want to change the default unit of measurements mm and kg to m and g.
How is this possible?
This is hard-coded in the Shopware core.
To change it, you would need to extend the administration theme (and probably also the store front, if this is displayed there).
For example it needs to be changed here sw-product-packaging-form.html.twig:
<template #suffix>
<span>mm</span>
</template>
I want to arange unequal high elements in a floating environment with bootstrap 4 and flexbox.
Without using flexbox in BS4 the elements are aranged in equal height ( <div class="row">). Applying flexbox like <div class="row d-flex flex-wrap align-items-start"> I get the desired alignment but if the elements have an unequal height they - of course - don't float.
Is there a way to achieve this to look
like the "former" BS3 bahaviour ?
I want to implement a general "algorithm" so that I can add elements without specifying the positions explicitly.
No, there's no way to get flexbox items to float.
However, you can override the display:flexbox on the Bootstrap 4 row, by using d-block and use the float utils. This has already be explained in several other questions.
Bootstrap 4 - I don't want columns to have the same height
Rearranging responsive Bootstrap 4 grid layout
Bootstrap Responsive Columns Height
Empty vertical space between columns in Bootstrap 4
Note that d-block is a responsive class (d-sm-block, d-md-block, etc...) which allows you to override flexbox responsively on specific breakpoints.
I use the LocalData of Joda Date type out of the box from JHipster. The field shows in a format of mm/dd/yyyy on Google Chrome. When creating a new data, "mm/dd/yyyy" will show up in the field. On IE and Firefox, however, the data format is yyyy-mm-dd. And when creating a new data, there isn't a date format indicator in the date field.
Another problem I notice is that a date will be one day earlier after the form is submitted. For example, if I enter 1986-11-12, 1986-11-11 will be saved into a DB. That occurs on all three browsers. I assume that isn't about the front end as the other problem.
The followings is a related html code generated by JHipster without any modification:
<div class="form-group">
<label translate="myApp.profile.dob" for="field_dob">Dob</label>
<input type="date" class="form-control" name="dob" id="field_dob"
ng-model="profile.dob" required>
<div ng-show="editForm.dob.$invalid">
<p class="help-block"
ng-show="editForm.dob.$error.required" translate="entity.validation.required">
This field is required.
</p>
</div>
</div>
The following is a screen shot on Google Chrome:
And here is a screen shot on Firefox:
And I use the latest version of JHipster.
How to fix those problems?
BTW, I would like to use Java 8 date library instead if there isn't so much change.
For the date format issue, I learn that a date format filter is needed in AngularJS code for a date or time field. So, it is better than the generated default AngularJS code come with a default date filter.
Which kind of input field do you use?
<input type="text" name="thedate">
or
<input type="date" name="thedate">
or something else?
The DB problem could be due to wrong timezones and i assume you don't only save the date, but also the time?!
When you add for example 1986-11-12, the server converts it to 1986-11-12 00:00:00. And if you use a local time (e.g. UTC+2 aka CEST - central europe summer time), your server converts it to "1986-11-11 22:00:00" which is finally saved in your database.
So, you should check, if you (partially) using datetime and not only localdate?
And for both cases I would check what's sent between the browser and the rest-endpoint, so you're able to isolate the problem to a server and/or javscript/html problem.
Update
The difference between chrome and IE/Firefox is due to a special handling by chrome, because it offers a built in datepicker for date-inputs. The default date format is taken from the local system setting. Look here: https://developers.google.com/web/updates/2012/08/Quick-FAQs-on-input-type-date-in-Google-Chrome
The actual format of the value (the raw-format) is always yyyy-mm-dd (according to the html rfc). This is also in chrome and only the presentation is changed by chrome. Since IE and Firefox don't offer a build-in datepicker, the raw format is used there. That's why there are different formats and why there is no datepicker in IE or Firefox.
So, you have to add a datepicker for IE/Firefox by yourself, e.g. using jquery, modernizr or an angular directive.
Using version 2.5.3 of ExpressionEngine, I have a list of products displayed by category, but I need the premium products among this list being featured with a small star image. How do you call conditionally this little stars besides the {title}?
At the moment this code shows stars for all products and that is not ideal.
<ol class="voices-list">
{exp:channel:entries channel="product" orderby="title" sort="asc" category="2&6" dynamic="no"}
<li>{title}<img class="feature_icon medium" src="{root_url}img/audio/smallstar.png" alt="star"></li>
{/exp:channel:entries}
</ol>
I need your help, please.
Best to set up a new checkbox field named "is_premium" with the value set to "y".
Next, edit each premium product entry and check the box and save.
Finally, in your template use this conditional.
{if is_premium == "y"}add star code{/if}
I like the approach shown in the answer posted by #MediaGirl and have used it many times.
An alternative approach is to handle it with a custom status rather than a custom field, if only to have the ability on the main edit screen to quickly and easily see and sort the list by "premium" (Zenbu could add the custom field to the edit screen, of course). The conditional would be similar, and of course the entries loop would need to have the status param of "open|premium".
I want to hide the first 6 characters of SSN when user types in the text box. Something like *--1234
Is there any built in tag I can achieve this. Thanks in advance.
The "built in" components of the standard JSF implementation only represents the standard HTML elements. Your functional requirement is not covered by any of those HTML elements, so the standard JSF implementation won't have it as well. The closest one is the HTML <input type="password"> which is provided by JSF <h:inputSecret> component, but this will mask all characters instead of only a specified subset.
Also no 3rd party JSF component libraries comes to mind which is able to do this. You have basically 2 options, an easy one and a harder one.
Split the SSN over two input fields. One <h:inputSecret> and one <h:inputText>. Add if necessary some onkeyup JavaScript helper code which auto-tabs to the next field when 6 characters are entered. In the server side just glue the two parts together.
Use a <h:inputHidden> for the value and a normal <input type="text"> with some onkeydown JavaScript helper code which fills the hidden input and returns the masked character to the visible input for the first 6 characters.