I am new to Prestashop 1.7
I need to show Firstname in order list in back office.
I found many answers for older versions of Prestashop but none for 1.7
Can anyone assist?
Change the line 259 in src/Core/Grid/Query/OrderQueryBuilder.php
return 'CONCAT(LEFT(cu.`firstname`, 1), \'. \', cu.`lastname`)';
For this:
return 'CONCAT(cu.`firstname`, \' \', cu.`lastname`)';
Related
When I import product data or I upload image directly to a product I get the following message (was not uploaded. Filename is too long; must be 90 characters or less)
Recently my magento has been updated and I didn't have this problem before.
Does anyone know how I can increase the number of characters slightly?
enter image description here
I was able to solve the problem myself.
The file in question is located in the following folder
vendor\magento\framework\File Uploader.php
search for the following code:
// account for excessively long filenames that cannot be stored completely in database
if (strlen($fileInfo['basename']) > 90) {
throw new \InvalidArgumentException('Filename is too long; must be 90 characters or less');
Adjusting this file is not the best method, I have to add
For anyone finding this question on Google, I wanted to share additional findings, as I've faced the same issue. Perhaps you will find them helpful.
As #Timo already wrote, the limit of 90 characters is hard-coded in the getCorrectFileName() method in vendor\magento\framework\File\Uploader.php (in older versions of Magento).
public static function getCorrectFileName($fileName)
{
(...)
$maxFilenameLength = 90;
if (strlen($fileInfo['basename']) > $maxFilenameLength) {
throw new \LengthException(
__('Filename is too long; must be %1 characters or less', $maxFilenameLength)
);
}
(...)
}
Since this method is static, writing a plugin is not possible and apparently providing a preference won't work as well.
It seems that there was a fix for this already available in Magento, but only in versions 2.4.2 and 2.4.2-p1. Then, for whatever reasons it got removed. See the related Github issue.
Since Magento v2.4.5 the file name length is now limited to 255 characters:
private const MAX_FILE_NAME_LENGTH = 255;
(...)
public static function getCorrectFileName($fileName)
{
(...)
if (strlen($fileInfo['basename'] ?? '') > self::MAX_FILE_NAME_LENGTH) {
throw new \LengthException(
__('Filename is too long; must be %1 characters or less', self::MAX_FILE_NAME_LENGTH)
);
}
(...)
}
So, until you upgrade your Magento version to 2.4.5 or newer, it seems that making a change in the core code is the only option, either manually or using a composer patch.
I have some not very clean 3rd party data that included numbers like:
PRICE
118.0000
99.0000
etc etc
normally would just use:
{price[1]}
but I just get price like $18,000,000.00 where it should be $118
I tried this (just guessing) ...
number{('price[1]')}
but nothing showed up for the price.
I also tried
format-number{(., 'price[1]')}
but that did not work.
Then I read I can use
translate(#Price, ',.', '.')
I tried that as
translate(#price, ',.', '.')
but no price showed
I then tried several variations using the [1] part , I'm only guessing as I'm not really a coder:
{translate(#price[1], ',.', '.')}
{translate(#price[1],',.','.')} ( I clean the spaces out)
then this one
translate(#price[1], ',.', '.')
and it finally showed a price but only as $1.00 where it should have been $1055 or another one should have been $1145 but they all showed $1.00
What can I do, it must be all on one line as it goes in my web based form to be submitted to import the data?
UPDATED:
Here is what I tried to write in the comments:
I tried these below and this is the results.I used your exact examples including the price as in the first 2 examples, then I tried with the "price" code but that is producing a $1 price again.
substring-before(118.00, '.') $11,800.00
substring-before('118.00','.')$11,800.00
substring-before('price[1]','.')$1.00
substring-before(price[1], '.')$1.00
I also tried using the brackets as I would normaly but that produces no price...
{substring-before(price[1], '.')}
{substring-before('price[1]','.')}
{substring-before('118.00','.')}
{substring-before(118.00, '.')}
I have tried to upload a much smaller copy of some of the input document and just changed some private details with "privatedomain" but I have no permission to include the links so they were deleted.
PROGRAMNAME PROGRAMURL CATALOGNAME LASTUPDATED NAME KEYWORDS DESCRIPTION SKU MANUFACTURER MANUFACTURERID UPC ISBN CURRENCY SALEPRICE PRICE RETAILPRICE FROMPRICE BUYURL IMPRESSIONURL IMAGEURL ADVERTISERCATEGORY THIRDPARTYID THIRDPARTYCATEGORY AUTHOR ARTIST TITLE PUBLISHER LABEL FORMAT SPECIAL GIFT PROMOTIONALTEXT STARTDATE ENDDATE OFFLINE ONLINE INSTOCK CONDITION WARRANTY STANDARDSHIPPINGCOST
PrivateName (deleted link) PrivateName - Product Catalog 2015-03-21 23:06:21.558 Ainsley Cuff, Gold $100-$299, cuff, gold, Open Cuff Captivatingly colorful, Kendra Scott’s collection will spruce up a basic sweater and can simultaneously fancy up a dressier cocktail frock. Her pieces have a southern influence, which brings fun, festivity, and charm to the collection’s aesthetic. 14k Gold Plated 2 Inches Wide Malleable kens-00005B Kendra Scott USD 120.0000 (deleted link) (deleted link)/jpeg_1.jpg Bracelets All Jewelry ,Designers,Shop All,All Jewelry,A-Z Designers,Shop by Occasion,Best of PrivateName,Kendra Scott,Office,Everyday,Vacation,Classic,Casual,Byzantine,Black and White,Gold,Cuff,Destination: Morocco,Back in Stock,Kendra Scott,Bracelets yes
PrivateName (deleted link) PrivateName - Product Catalog 2015-03-21 23:06:21.559 Crystal Deco Brooch $100-$299, crystal "Part of the Ben-Amun Evening Collection. Antique silver-plated over brass Clear Swarovski crystals Length 2.5"" NOTES: This product is made-to-order. Please allow up to 2-3 weeks for delivery. Expedited shipping is not available." BAMU-00037P Ben-Amun Bridal USD 195.0000 (deleted link) (deleted link)/jpg_2.jpg Brooches Collections,Shop By,Designers,Brooches,All Jewelry,Bridal,A-Z Designers,Jewelry Trends,Evening,Bridal,Deco,Crystal,Estate,Ben-Amun Bridal,Shop All yes
PrivateName (deleted link) PrivateName - Product Catalog 2015-03-21 23:06:21.559 Gold Teardrop Cutout Earrings $0-$100, gold "Wendy Mink’s jewelry mixes aspects of traditional Eastern jewelry with classic European design principles. Her pieces are carefully handmade with simple yet unexpected combinations of colors, materials, and shapes. Her collection draws inspiration from textiles created by women in India, Nepal, and Tibet—three regions she spent a great deal of time in while holding a position at the World Bank prior to reinventing herself as a jewelry designer. Gold-plated, 18kt Length 2.5"" Width 1.75"" French wire hook NOTES: This item is made to order and may take up to 3 weeks for delivery." wndm-00107E Wendy Mink USD 73.0000
Please let me know if you need anything else:
If you are using XPATH 1.0 you might be able to use substring-before(xpath, expression)
substring-before(118.00, '.')
should give 118 if I'm not mistaking.
I need to change Magento's default decimal format. I mean, when I save '1' to a decimal field, it becomes '10000.0000' with this '.0000' in the end.
I need to change it to another format, which uses ',' instead of '.' to separate decimal (and currency) numbers.
This is the Brazilian standard and it's not being used even after changing the store language. This change should be reflected mainly in the admin side.
Thanks a lot!
==Edited==
I haven't solved the problem yet. I'm using PT-BR (Brazilian Portuguese) as default language and it still using the wrong decimal character.
It seems Magento have some not-localized price formatting (I mean, hard-coded) in a few points of code. For example: magento\js\prototype\validation.js at line 426 have:
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
but instead it needs to be
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
to fit into PT-BR format (or other locales to).
Am I right? Does anybody could fix this issue?
if you want to check in admin area for this change
you go to in admin left bottom drop down
and select
Português (Portugal) / português (Portugal)
it will show you currency as you want. Also if you doesn't install you package go to
http://www.magentocommerce.com/translations/list/19
download your package and add it to your
locale folder and select from configuration for front end also
hope this will sure help you.
I've applied the following change to the file magento\js\prototype\validation.js (line 426):
|| (!isNaN(parseNumber(v)) && /^\s*-?\d*(\,\d*)?\s*$/.test(v));
and also, changed the file lib/Varien/Data/Form/Element/Abstract.php by adding the first if statement:
public function getEscapedValue($index=null)
{
$value = $this->getValue($index);
if(is_numeric($value)){
$value= number_format($value, 3, ",", ".");
}
...
this changes have solved the problem so far. Do you see any side-effect?
Comments are welcome! Thanks!
Newer versions of Magento are based on Zend Framework currency locale format so the best way to do this is to change the language.xml from the Zend directory, more information is on this great article.
The currency I'm using in the Magento site I'm creating is Japanese Yen which does not have decimals in their currency. I've managed to remove it from my product page and cart.
By modifying app/code/local/Mage/Directory/Model/Currency.php inside format function like so:
$locale = Mage::app()->getLocale()->getLocaleCode();
if($locale != 'ja_JP') {
return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
} else {
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
}
However, in the dropdown attribute I created, the decimal still shows. Like so:
White - ¥3000.00
Blue - ¥5000.00
In my dropdown attribute, how can I drop .00 at the end of the price? Also, is it possible to drop decimal for the admin without altering the database?
I've tried searching but sadly, Magento does not have a direct feature that would handle this. Or at least I haven't come across said feature.
You can add this piece of code on beginning of formatTxt method in the same class you was editing:
if(Mage::app()->getLocale()->getLocaleCode() == 'ja_JP') {
$options['precision'] = 0;
}
This will change the precision for prices in almost every place inside Magento (like Catalog, Checkout, even Administration).
Check code of free ET_CurrencyManager extension to find a solution. You need to modify more that one funstion in Mage_Directory_Model_Currency. Also you need to modify precision for JS scripts too in Mage_Core_Model_Locale::getJsPriceFormat.
Or just use this extension to avoid core files modifications.
In fact the Zend local format for JA (Japnese) is wrong, see file:-
httpdocs/lib/Zend/Locale/Data/ja.xml
Line: 2953 (or just search for "0.00")
Update to the following:-
<currencyFormats>
<currencyFormatLength>
<currencyFormat>
<pattern>¤#,##0</pattern>
</currencyFormat>
</currencyFormatLength>
</currencyFormats>
This will completely change the YEN display price to have zero decimals within the JA Locale.
A couple of words of warning...
The admin area if viewed in any locale other than ja_JP will allow a
decimal price to be entered, entering a YEN price with a decimal
position of anything other tha ".00" will result in a checkout price
mismatch error.
It appears that Magento will always send prices to
PayPal with two decimal positions and this will cause price mismatch
errors when applying coupon or Sale discounts (Mage 1.6) - I'm
currently working through this issues on this and testing against
1.9 Version.
Okay, so I managed to remove .00 by modifying configurable.js and product.js. It's not a direct solution but a workaround.
For each file, I split the price string removing any decimal points(.) and numbers succeeding it by using the split function of javascript. So I added something like so:
var a = price.split(.);
return a[0];
Using that, all the decimals have been dropped from my prices. Thanks for all your time and help.
I need to show 2 prices in different currencies on a flypage, but I haven't found a recipe for it so far. Could anyone help me?
You could probably do this by adding a new input field.
To do this, needs a little coding...
1 - Edit the file default_showprices.php in template folder (/templates/YOUR_TEMPLATE/html/com_virtuemart/productdetails/default_showprices.php)
2 - Get the currency_id ( from virtuemart admin ). For example, I use the US$ currency ID: 144.
3 - Place this code bellow in any line of the file:
echo '<b>US$: '.$this->currency->roundForDisplay($this->product->prices['salesPrice'],144,1,false).'</b>';
This code will print the price converted to US$.