chaddro / easypopulate-4.0 Goto Github PK
View Code? Open in Web Editor NEWData import and export module for Zencart 1.3.x and 1.5.x
License: GNU General Public License v2.0
Data import and export module for Zencart 1.3.x and 1.5.x
License: GNU General Public License v2.0
This took me a little while to nail down. Basically, people would update/populate their store with the FULL-EP sheet and set the metatag status flags to their their liking. Then, a subsequent update from a PRICEQTY-EP sheet would mysteriously change the flags.
What in fact is happening, is the current setting in the database are not being retained. These need to be added to the $default_these[] array (as many others needed to be). This should fix the issue.
When importing to a store with multiple languages installed, EP4 is not creating the additional entries to TABLE_CATEGORIES_DESCRIPTION.
In easypopulate_4.php you might want to change $_SERVER["PHP_SELF"] to $_SERVER['SCRIPT_NAME'].
As more and more people switch to nginx and php-fpm, this would be an issue for them,
See here for more info: https://bugs.php.net/bug.php?id=55208
BTW, thanks for making this much needed update!
Hi...
I would like to know if there's a new version coming soon with the capability of create new records and update it including the new dimensional weight shipping fields requirements.
We have installed on our store the EP 1.5x version and were looking to update to the EP4.0, but neither one have this capability.
If no, what's the best way to get around ?
thank you.
My zen cart version is 1.5.3 and EasyPopulate version 4.0.24.
I uploaded my own items using Attrib-Basic-EP-examples.csv template and the message showed that my items got updated correctly. When i checked it under zen cart> admin>catalog> Attributes Controller, no attributes were added to my items and all item names got EMPTIED for the items listed in the csv file.
Can you please check if this is a bug? Thank you for your help.
Justin
Can you change fopen/update type from import file.
e.g: $handle = fopen($file_location, "r") to $handle = fopen($file_location, "rb")
Then update one row at a time to sql.
"i need a function to simulate a "wget url" and do not buffer the data in the memory to avoid thouse problems on large files..." - http://php.net/manual/en/function.fopen.php
Then do not need to split files.
My test server is running windows, PHP 5.6.8. When I export a CSV and import it again, the special price dates all get set to the 1970, making them inactive.
easypopulate_4_import.php, line 1521~ seems to be the cause
// using new date functions - chadd
$v_specials_date_avail = ($v_specials_date_avail == true) ? date("Y-m-d H:i:s",strtotime($v_specials_date_avail)) : "0001-01-01";
$v_specials_expires_date = ($v_specials_expires_date == true) ? date("Y-m-d H:i:s",strtotime($v_specials_expires_date)) : "0001-01-01";
To test, I tried this code on both my test server and my production server
<?php
$v_specials_expires_date = "0001-01-01";
echo date("Y-m-d H:i:s",strtotime($v_specials_expires_date));
Test server running Windows, PHP 5.6.8 outputs 1970-01-01 01:00:00
Production server running Linux PHP 5.4.34 outputs 0001-01-01 00:00:00
Hi,
I exported my categories and re-imported them. My expectation was that nothing will happen cause I haven´t altered the file.
But after the Import I had all subcategories added right next to the main categories.
It seems that the SQL "parent_id" is not exported - therefore the import does not have any information about the structure of the categories. I have looked a bit on the code here but I´m not a good programmer so I couldn´t find the point where this is missing.
Rgds, Richard
It should be noted that the there is not error checking on Manufacturer's name length exceeding the maximum length in database.
If you use a Manufacturer's name longer than supported in the database, EP will created duplicate manufacturer's at the truncated name since it is unable to find a match on search.
I should also check the categories names and products model as this could cause problems here as well.
Hi,
I just found out that the folder structure in den zip-file is wrong - at least for my setup (german version of zen-cart from zen-cart-pro.at).
the folder in the zip file is called:
"EasyPopulate-4.0-master\admin\includes\languages\deutsche"
This will be copied to the webserver (everything inside the "admin" subfolder of course - the language files will be in a folder named "deutsche" which doesn´t reflect the original folder structure which has a folder named "german".
Simply moving the files over to the "german" folder will make the plugin work.
So I´d say the folder "EasyPopulate-4.0-master\admin\includes\languages\deutsche" needs to be renamed ;-)
Thanks for the nice tool.
rgds, richard
MySQLi error 1146: Table 'mrshehata9_zc1.zc_products_with_attributes_stock' doesn't exist
When executing:
SHOW COLUMNS FROM zc_products_with_attributes_stock
using EP4 and open office
also
I downloaded a file made some corrections and tried to uploaded, I got the same error.
Thanks.
// mc12345678 below routine: categorymeta-ep could possibly clear assignments of
// data if the field(s) are not included in the download file. This
// needs to be modified to allow a reduced set of columns to be imported.
Just discovered that Zencart will let you add quantity discounts, but allow you to set the discount type to None (0). This will, in effect, deactivate the quantity discounts.
This presents a small issue for EP4 which will not export any quantity discounts if it finds a discount type of None. I have to check, but I believe that I also use 0 to delete existing discounts.
When I export full product information, I found the line end is removed from the product description. All my multi-line product description becomes one paragraph.
I found the code deliberately removed the \r \n chars, but not sure exactly why. I understand ms excel has problems to deal with special chars between "". But open office or libre doesn't. And this is very clearly stated in the readme.
This actually make the import/export product information not usable.
I would like to know the consideration here.
Thanks.
in the following code in easypopulate_4_functions.php
function ep_4_rmv_chars($filelayout, $active_row, $csv_delimiter = "^") {
// $datarow = ep_4_rmv_chars($filelayout, $active_row, $csv_delimiter);
$dataRow = '';
$problem_chars = array("\r", "\n", "\t"); // carriage return, newline, tab
foreach ($filelayout as $key => $value) {
// $thetext = $active_row[$key];
// remove carriage returns, newlines, and tabs - needs review
$thetext = str_replace($problem_chars, ' ', $active_row[$key]);
// encapsulate data in quotes, and escape embedded quotes in data
$dataRow .= '"' . str_replace('"', '""', $thetext) . '"' . $csv_delimiter;
}
// Remove trailing tab, then append the end-of-line
$dataRow = rtrim($dataRow, $csv_delimiter) . "\n";
return $dataRow;
}
change the line:
$problem_chars = array("\r", "\n", "\t"); // carriage return, newline, tab
to
$problem_chars = array("\t"); // carriage tab
will just do the job and don't break the csv downloading
it is also interesting to see this line:
// remove carriage returns, newlines, and tabs - needs review
When creating an entry for a new manufacturer via import, the manufacturers_info table is not getting an entry for each language installed.
This must be done, else the manufacturers_url cannot be edited or updated after the fact. (not that this gets used much!)
Hi,
I this wondered if you are keeping this up to date. I posted a few patches on the forums which have been incorporated into the fork here
https://github.com/mc12345678/EasyPopulate-4.0
I note yours is now behind his and just wasn't sure what was the best thing to follow !
B. Rgds
John
Would be a nice addiction to add to the categorymeta
export the categories "tree". I found this very useful ( at least to be around) to make data validation lists in libre calc or excel: #
Something like:
// Multi-Lingual Categories, Categories Meta, Categories Descriptions
if ($ep_dltype == 'categorymeta') {
// names and descriptions require that we loop thru all languages that are turned on in the store
foreach ($langcode as $key => $lang) {
$lid = $lang['id'];
// metaData start
$sqlMeta = 'SELECT * FROM ' . TABLE_METATAGS_CATEGORIES_DESCRIPTION . ' WHERE categories_id = :categories_id: AND language_id = :language_id: LIMIT 1 ';
$sqlMeta = $db->bindVars($sqlMeta, ':categories_id:', $row['v_categories_id'], 'integer');
$sqlMeta = $db->bindVars($sqlMeta, ':language_id:', $lid, 'integer');
$resultMeta = ep_4_query($sqlMeta) or die(($ep_uses_mysqli ? mysqli_error($db->link) : mysql_error()));
$rowMeta = ($ep_uses_mysqli ? mysqli_fetch_array($resultMeta) : mysql_fetch_array($resultMeta));
$row['v_metatags_title_' . $lid] = $rowMeta['metatags_title'];
$row['v_metatags_keywords_' . $lid] = $rowMeta['metatags_keywords'];
$row['v_metatags_description_' . $lid] = $rowMeta['metatags_description'];
// metaData end
// for each language, get category description and name
$sql2 = 'SELECT * FROM ' . TABLE_CATEGORIES_DESCRIPTION . ' WHERE categories_id = :categories_id: AND language_id = :language_id: LIMIT 1 ';
$sql2 = $db->bindVars($sql2, ':categories_id:', $row['v_categories_id'], 'integer');
$sql2 = $db->bindVars($sql2, ':language_id:', $lid, 'integer');
$result2 = ep_4_query($sql2);
$row2 = ($ep_uses_mysqli ? mysqli_fetch_array($result2) : mysql_fetch_array($result2));
$row['v_categories_name_' . $lid] = $row2['categories_name'];
$row['v_categories_description_' . $lid] = $row2['categories_description'];
// $display_cat_tree - Some sort of configuration
$display_cat_tree = true;
if ( $display_cat_tree == true) {
// look for parent categories ID and Name
$sql_cat_tree = 'SELECT c.parent_id , cd.categories_name as parent_name FROM ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd WHERE c.categories_id = :categories_id: AND cd.categories_id= c.parent_id ORDER BY cd.categories_name';
$sql_cat_tree = $db->bindVars($sql_cat_tree, ':categories_id:', $row2['categories_id'], 'integer');
$result_cat_tree = $db->Execute($sql_cat_tree);
if ( $result_cat_tree->RecordCount() > 0) {
// Display the full categorie path. Found this is very usefull for ie. To create a data validation on Excel or Calc
$row['v_categories_tree_' . $lid] = $result_cat_tree->fields['parent_name'] . $category_delimiter . $row['v_categories_name_' . $lid];
} else {
$row['v_categories_tree_' . $lid] = $row['v_categories_name_' . $lid];
}
}
} // foreach
if (EASYPOPULATE_4_CONFIG_EXPORT_URI != '0') {
$row['v_html_uri'] = zen_catalog_href_link(FILENAME_DEFAULT, zen_get_path($row['v_categories_id']), 'NONSSL');
}
} // if ($ep_dltype categorymeta...
Currently, if you add a NEW product, you must provide a Category path. If no category path is specified, the NEW product will be skipped.
If you want to UPDATE a products information, for the most part you only need the products_model and the columns you want to update. However, if you are going to update any language specific column (i.e. v_products_description_1) you MUST also include the column v_products_name_1.
If you don't include v_products_name_x, and try to update v_products_description_x, the script will actually tell you UPDATED when it if fact HAS NOT updated the record.
Came across this issue today. Old versions of EP would enter a NULL value in the products table for entries where no manufacturer is assigned. But, when you add a new product from within the zencart admin, and do not assign a manufacturer, the admin defaults this to zero.
Zero, for zencart, means no manufacturer. ID's in the manufacturer's table start at 1, not zero.
The code currently tests for '0'. If there are NULL values, this can through an error. For best compatibility, I should test for both possibilities. However, 0 is the "correct" value.
Need to be sure this condition is error trapped.
$category_delimiter = "\x5e" , doesn't seen to be splitting and ends up in names length error
Changing to :
$category_delimiter = '\x5e' , it's ok
Categories example:
select the forum that you want^to visit from the selection
When importing attributes to a store with more than 1 language installed, the database entries for the additional languages are not being create (even the default values).
This is similar the the issue when creating category entries.
Observed: memory_get_usage() requires PHP version 4.3.2 or greater.
Need to perform a function exists, and skip this info if on an older system.
Attrib-Basic-EP2018Jan08-183728T.txt
I want to import an attribute Color for all my products. I defined already all colors.
when I import all rows become a new option name.
be aware I could not import csv as extension, so uploaded as txt.
using zen-cart 1.55e
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.