Zen Cart Logo
Forums / Addon Admin Tools / EasyPopulate 4.0 Support Thread

EasyPopulate 4.0 Support Thread

Sticky

Views: 733,378

Results 2,781 to 2,800 of 3,671
27 Jul 2017, 10:06 PM
#2781
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

EasyPopulate 4.0 Support Thread

Feznizzle:

Thanks, MC!

Would these changes do the trick?

if ($ep_uses_mysqli) {
$collation = mysqli_character_set_name($db->link); // should be either latin1 or utf8
} else {
$collation = mysql_client_encoding(); // should be either latin1 or utf8
}
if ($collation == 'latin1') {
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding("iso-8859-1");
}
}

if (($collation == 'latin1') && ((substr($project, 0, 5) == "1.3.8") || (substr($project, 0, 5) == "[B]1.3.9[/B]"))) {
//mb_internal_encoding("iso-8859-1");
$category_strlen_max = $category_strlen_max / 3;
$categories_name_max_len = $categories_name_max_len / 3;
$manufacturers_name_max_len = $manufacturers_name_max_len / 3;
$products_model_max_len = $products_model_max_len / 3;
$products_name_max_len = $products_name_max_len / 3;
$products_url_max_len = $products_url_max_len / 3;
$artists_name_max_len = $artists_name_max_len / 3;
$record_company_name_max_len = $record_company_name_max_len / 3;
$music_genre_name_max_len = $music_genre_name_max_len / 3;

$zco_notifier->notify('EP4_COLLATION_UTF8_ZC13X');

}

> 
> Also, the reason I highlighted the reference to **1.3.9** is that the site I'm working on is a 1.3.9**h**. Should I change that as well? 
> 
> Thanks again!

Couple of things.  Let's start with what looks like a little bit of a history lesson on ZC (based on some independent review of old ZC code and system response to by a ZC 1.5.1 site) and why some of the above code is present. It would appear that back "in the day" (ie. before ZC 1.5.0), that the includes/configure.php and admin/includes/configure.php did not include a DB_CHARSET setting.  Therefore part of the interface with the database was to respond/identify whatever characterset was otherwise associated or set in the database itself.  A little bit about that though means that if the database responded that it was using UTF-8, then the maximum field length report for the associated fields would be reported related to UTF-8 sizing but expect that the software wouldn't be able to properly encode the characterset back into "multibyte" related utf8 (or in other words identify that there are more "letters" available than what the field would actually be able to take, basically reporting back the size of the field to be 3 times what it would accept).  Now most of this was already written before I came along and looking back in the history these changes were incorporated ever more to maintain support for older systems while continuing to develop or provide for newer systems.  The test for 1.3.9 looks at the first 5 characters of the $project variable.. Regardless of which sub-version of ZC 1.3.9, the first five characters are 1.3.9, so there is no change needed in that particular portion of the code.

Basically all that to say, that in the second part of the code, you wouldn't want to reduce the size of the available fields if the $collation was identified as latin1, therefore that section would remain unchanged.

A "bigger" problem though in using the more recent software is that it appears that there is a response indicating that the database may be responding back with utf8... And that is causing the "conversion" that is occurring of unusual characters in the csv file (when viewed in iso-8859-1 format)... If the problem is visible that soon in, then I have a few recommendations to "test" or check, but yes generally it looks like changing the code in this area is all that is necessary. (There may be an issue with the character used for the category name separator, but one step at a time).

So, here's what I suggest first:

if ($ep_uses_mysqli) {
$collation = mysqli_character_set_name($db->link); // should be either latin1 or utf8
} else {
$collation = mysql_client_encoding(); // should be either latin1 or utf8
}

echo 'collation: ' . $collation . "\n";

if ($collation == 'utf8') {
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding("UTF-8");
}
}

if ($collation == 'latin1') {
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding("iso-8859-1");
}
}

if (($collation == 'utf8') && ((substr($project, 0, 5) == "1.3.8") || (substr($project, 0, 5) == "1.3.9"))) {
//mb_internal_encoding("UTF-8");
$category_strlen_max = $category_strlen_max / 3;
$categories_name_max_len = $categories_name_max_len / 3;
$manufacturers_name_max_len = $manufacturers_name_max_len / 3;
$products_model_max_len = $products_model_max_len / 3;
$products_name_max_len = $products_name_max_len / 3;
$products_url_max_len = $products_url_max_len / 3;
$artists_name_max_len = $artists_name_max_len / 3;
$record_company_name_max_len = $record_company_name_max_len / 3;
$music_genre_name_max_len = $music_genre_name_max_len / 3;

$zco_notifier->notify('EP4_COLLATION_UTF8_ZC13X');

}

The first "addition" is present to see what the actual returned value is, because in order to accomplish what is desired it may be necessary to not let EP4 think that it should be able to communicate in utf8, but instead push/force latin1 style formatting as a result of the observed outcome.  There are other factors to review/confirm as well in the setup of the store and associated collation information.  Basically EP4 expects the store to be setup correctly. 

After making the first above change, when viewing the EP4 screen you should see text above the standard ZC admin screen indicating either utf8 or latin1. I am expecting that it says latin1 based on all of the discussion.

Can you also indicate what is displayed on the EP4 admin screen associated with the screen item: 'Internal Character Encoding:'?

Does it provide a result or does it say something like: ''mb_internal_encoding not available"?

The next thing to do after reporting all of that information would be to attempt to export, review the data.

When successful, export something "small" like a single category (disabled with disabled product?) that may have a single product with a really long product name, then without opening the file, attempt to upload that one product back and see if there are length/truncation result(s) reported (not expected). Then also look at the product itself and see if/what got modified about it (Should be nothing).  Again export the product, compare the two files to see what if any differences now exist (again expect nothing).
Then attempt to open a copy of one of the files, turn around and save the file, again remembering the encoding.
Upload and then import the file (should be no changes on site).
Again export and compare that export with one of the previous (again no differences expected).

You're in an "opportune" position to be able to test/validate the operation because of the setup involved.
27 Jul 2017, 11:09 PM
#2782
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

Yes, it says latin1.

Internal Character Encoding says ISO-8859-1, same as before.

When I exported, imported, and then re-exported, the only difference between the export files is that the date/time changed to 0000-00-00 00:00:00. I don't think anything was truncated.

But when I opened the file to make some changes, I found garbage right away. I chose a category containing products with ™ symbols in the name. The symbols were replaced with: ô

Uggg.

28 Jul 2017, 12:42 AM
#2783
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: EasyPopulate 4.0 Support Thread

Feznizzle:

Yes, it says latin1.

Internal Character Encoding says ISO-8859-1, same as before.

When I exported, imported, and then re-exported, the only difference between the export files is that the date/time changed to 0000-00-00 00:00:00. I don't think anything was truncated.

But when I opened the file to make some changes, I found garbage right away. I chose a category containing products with ™ symbols in the name. The symbols were replaced with: ô

Uggg.
So, there were two files exported. First, did both present the same "garbage" second, what encoding/viewer was used to view the file(s)?

Unusual that the date got set to 0000-00-00 instead of the database preferred 0001-01-01 style, but if the site itself could export and import the exported file without any character encoding issues, then that means that EP4 is doing its part just fine. The problem is in the next "tool" which is reading, expecting or converting the file to be utf8 which is then causing the observed "garbage" ie. looking at latin1 in utf8 can cause characters to look as junk.

28 Jul 2017, 12:54 AM
#2784
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

Yes, garbage in both files. I use Open Office. Can I switch CharSets in there?

28 Jul 2017, 1:33 AM
#2785
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: EasyPopulate 4.0 Support Thread

Feznizzle:

Yes, garbage in both files. I use Open Office. Can I switch CharSets in there?
Of course.

When opening the file, you should be presented with an option to import text. The first box is the character set. Change that from unicode (utf-8) to Western Europe (ISO-8859-1) then follow the remainder of the settings to support import. I provide this information based on Apache Oppenoffice 4.1.3. I haven't updated or attempted to update recently to identify if/what differences might exist in the options to reach various features. That aspect is something that should be addressed through the tool of use's help/assistance.

28 Jul 2017, 2:05 AM
#2786
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

Doh! Can't believe I missed that. Well, the garbage is gone... but so is the trademark symbol. :(

28 Jul 2017, 3:38 AM
#2787
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: EasyPopulate 4.0 Support Thread

Feznizzle:

Doh! Can't believe I missed that. Well, the garbage is gone... but so is the trademark symbol. :(

Did it remain between import/export of the original file and only disappear when loaded into open office?

I found this which suggests you may want to also adjust the font style in the process: https://wiki.openoffice.org/wiki/Documentation/FAQ/Writer/FormattingText/How_do_I_insert_a_trademark_symbol%3F

Otherwise I thought that there might be some differences that may help by using Libre?

28 Jul 2017, 12:01 PM
#2788
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

Same thing occurs in Libre.

28 Jul 2017, 2:35 PM
#2789
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

I just downloaded, added trademark and registration symbols to product titles. TM works but still no dice on ®.

At the top of the screen, I noticed this message: "collation: latin1 "

In Libre/OO, I can choose:
Unicode (utf-8)
Western Europe (ISO-8859-1)
Latin 3 (ISO-8859-3)

Notably missing:
Latin 1 (ISO-8859-1)

Could that be the problem? What if I switched EP4 to Latin 3 (ISO-8859-3)?

Hope that's not horribly dumb, just tossing out thoughts.

28 Jul 2017, 2:54 PM
#2790
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: EasyPopulate 4.0 Support Thread

Feznizzle:

Same thing occurs in Libre.
Though doesn't/didn't seem like it should have an effect, what special conversions are setup in the configuration of ep4. It could be that maybe that character should be replaced with the html equivalent?

See, in Open Office they said that to add such a symbol would require using a particular font, I don't know if the character is otherwise always there but not visible like if the font is chosen, the character entered, then the font changed, and then possibly changed back, does the character magically "disappear and reappear?". If so, then for peace of mind would use "that" font while editing but understand that the font won't exist when saving though the characters should still be present and then upon upload they should still be there as well...

As far as encoding changes? Otherwise it's testing time to see what can be done to get what is desired...

28 Jul 2017, 3:12 PM
#2791
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

I'll try replacing with html equivilent again.

In the mean time, I went to the DB using Sequel Pro and clicked Table Info (was looking at products-description). Found this info:

CREATE TABLE `products_description` (
  `products_id` int(11) NOT NULL AUTO_INCREMENT,
  `language_id` int(11) NOT NULL DEFAULT '1',
  `products_name` varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `products_description` text COLLATE utf8_unicode_ci,
  `products_url` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `products_viewed` int(5) DEFAULT '0',
  PRIMARY KEY (`products_id`,`language_id`),
  KEY `idx_products_name_zen` (`products_name`)
) ENGINE=MyISAM AUTO_INCREMENT=11640 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

I don't understand SQL (or any coding, really), but looks like the db wants utf8... is that right??? If so, then EP4 should have worked off the shelf. But EP4 seems to have improved since switching away from UTF8.

Naaaarg. lolz

28 Jul 2017, 3:47 PM
#2792
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: EasyPopulate 4.0 Support Thread

Feznizzle:

I'll try replacing with html equivilent again.

In the mean time, I went to the DB using Sequel Pro and clicked Table Info (was looking at products-description). Found this info:

CREATE TABLE products_description (
products_id int(11) NOT NULL AUTO_INCREMENT,
language_id int(11) NOT NULL DEFAULT '1',
products_name varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
products_description text COLLATE utf8_unicode_ci,
products_url varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
products_viewed int(5) DEFAULT '0',
PRIMARY KEY (products_id,language_id),
KEY idx_products_name_zen (products_name)
) ENGINE=MyISAM AUTO_INCREMENT=11640 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

> 
> I don't understand SQL (or any coding, really), but looks like the db wants utf8... is that right??? If so, then EP4 should have worked off the shelf. But EP4 seems to have improved since switching away from UTF8.
> 
> Naaaarg. lolz

Okay, would like to regroup a little. 

Right now, what is going on is that the database is prepared to handle utf8, but everything about the store is "in the past" and pushing latin1/ISO-8539-1 to the database (and expecting everything that comes from the database to be in the same format regardless of how it is stored). The next thing about all this as pointed out earlier, export followed by import of the same file made no changes to the content which is everything about EP4 functionality did not affect the encoding.   Therefore, EP4 never was a problem from what can be determined.  The problem has been in editing and properly storing the edited file to be able to be handled by EP4.  

Right now the store is in a mixed state which is typically undesirable and could become problematic with upgrading as well considering that latin1 is trying to be pushed to utf8 instead of latin1 to latin1 and utf8 to utf8.  But that all is a different topic.

Again, EP4 is not the issue regarding the character encoding with the upload or download. Right now it is finding a suitable editor that will allow the full use of the characters that have been presented to the database. Without completely installing a system with similar setup which may or may not be possible based on the age of software and availability of similar setup, all I can really do at the moment is offer guidance/suggestions of ways to work around it.  I might be able to setup a local server and platform on my computer, but seems like it would take up several hours of time to do.
28 Jul 2017, 3:59 PM
#2793
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

Thank you for the offer, I'd happily buy some coffee to make it worthwhile for you. But I'm hoping that won't become necessary because I'm now thinking that maybe the solution is simply changing the site files to expect UTF8, per these instructions:
https://www.zen-cart.com/content.php?313-should-i-convert-my-store-from-iso-8859-1-to-utf8

Of course, because my db is already expecting utf8, I won't need to run that mod... just change language and config files.

I'll give that a quick whirl, report back.

28 Jul 2017, 4:28 PM
#2794
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

YAHOOOOOOO!

Houston we are a GO!

I have no idea when/how/why the site's db got upgraded and I'm beyond stumped about why the config/language files did not also get upgraded... but holly-frikken-lujah it's working like a charm baby!!!!

Awesome. Thank you so much for the help, MC!

Hopefully there will be no other repercussions from changing that, like payment processing or some other mod wanting iso-8539-1. But if there are, I'll deal with it later.

28 Jul 2017, 4:38 PM
#2795
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: EasyPopulate 4.0 Support Thread

Feznizzle:

YAHOOOOOOO!

Houston we are a GO!

I have no idea when/how/why the site's db got upgraded and I'm beyond stumped about why the config/language files did not also get upgraded... but holly-frikken-lujah it's working like a charm baby!!!!

Awesome. Thank you so much for the help, MC!

Hopefully there will be no other repercussions from changing that, like payment processing or some other mod wanting iso-8539-1. But if there are, I'll deal with it later.
As eluded/discussed by DrByte and I have seen this, you may want to take a peek at the define pages at a minimum to validate that they are not already encoded in "latin1" then also other "places" where specifically latin1 was used (though that would be easier to identify through a comparison program of old to new or original to edited).

Congrats that things are working (better). :P would suggest updating the referenced thread to summarize the "solution" or at least the condition.

28 Jul 2017, 4:51 PM
#2796
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

Great advice, I will grep the php files for any references to latin1 and/or iso-8539-1.

And I'll update the original thread. TTFN! :)

28 Jul 2017, 6:49 PM
#2797
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

Now that I'm able to use EP4, I have a question related to creating categories.

When you export products, a category path comes with it. But when you export "Categories Only (with Metatags)", no path is given. This becomes a problem when you have a lot of categories (I have 1351) and you wish to add blurbs to each (category description/meta data).

Quick example using pets:
Dogs^Brown^Furry
Cats^Brown^Furry

I now have two "Brown" categories and two "Furry" categories, but no way to know which refer to Cats and which refer to dogs... thus I'd don't know where to put which descriptions.

So my question:
Is there a way to ask EP4 to include a category path column with the "Categories Only (with Metatags)" export?

Thanks!

29 Jul 2017, 1:42 AM
#2798
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: EasyPopulate 4.0 Support Thread

Feznizzle:

Now that I'm able to use EP4, I have a question related to creating categories.

When you export products, a category path comes with it. But when you export "Categories Only (with Metatags)", no path is given. This becomes a problem when you have a lot of categories (I have 1351) and you wish to add blurbs to each (category description/meta data).

Quick example using pets:
Dogs^Brown^Furry
Cats^Brown^Furry

I now have two "Brown" categories and two "Furry" categories, but no way to know which refer to Cats and which refer to dogs... thus I'd don't know where to put which descriptions.

So my question:
Is there a way to ask EP4 to include a category path column with the "Categories Only (with Metatags)" export?

Thanks!

Sorry I missed seeing this earlier.

Yes, can be added. Export setup would need the field added to be captured, incorporate the same/similar "building" from the product's export, and done.

Now understand that it would be/should be only for informational purposes. Ie. Won't be able to modify it and make it do anything when importing by the intended filename. Otherwise, (and perhaps it was an omission) it has always seemed like that the category field modifications would be done somewhat along side the store's admin viewer where the category number is "obvious" for each such category.

But, I can see the benefit also. :)

I'll see what I can put together and upload to github.

30 Jul 2017, 5:36 PM
#2799
feznizzle avatar

feznizzle

Totally Zenned

Join Date:
Apr 2010
Posts:
900
Plugin Contributions:
0

Re: EasyPopulate 4.0 Support Thread

Awesome!

And information is all that is needed, really. This particular site sells parts, all products live 3 categories deep. All categories are structured like this:
Equipment-Type^Manufacturer-List^Model-Number

So my middle category has about 150 duplicate names and there is no way to know which Master they belong to, thus no what to quickly add a description. The real bugger though is that bottom category. Even though there are very few duplicates, that's a list of about 1000 model numbers. Without knowing the parent cats, it's next to impossible to automate the addition of a description, meta info, etc.

I just saw that you put up a solution on GitHub. I haven't tried it yet, but HUGE thanks! I will report back as soon as I have a chance to try it out.

What I was going to do---prior to the new code you just supplied---was export the category table direct from mySQL, then use vlookup over and over until I had it all sorted.

Maaaan that would have been painful. Huge thanks!!!!

30 Jul 2017, 6:29 PM
#2800
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: EasyPopulate 4.0 Support Thread

Feznizzle:

Awesome!

And information is all that is needed, really. This particular site sells parts, all products live 3 categories deep. All categories are structured like this:
Equipment-Type^Manufacturer-List^Model-Number

So my middle category has about 150 duplicate names and there is no way to know which Master they belong to, thus no what to quickly add a description. The real bugger though is that bottom category. Even though there are very few duplicates, that's a list of about 1000 model numbers. Without knowing the parent cats, it's next to impossible to automate the addition of a description, meta info, etc.

I just saw that you put up a solution on GitHub. I haven't tried it yet, but HUGE thanks! I will report back as soon as I have a chance to try it out.

What I was going to do---prior to the new code you just supplied---was export the category table direct from mySQL, then use vlookup over and over until I had it all sorted.

Maaaan that would have been painful. Huge thanks!!!!
No problem, as said, the information makes sense from a usability standpoint, but also leads to the potential of users misunderstanding that modifying it the same way as done with the full product data will provide the same results. I'll incorporate it into the master thread so that others can benefit from the change.