macopedia / magmi-m2

Magmi GitHub, see branch magento2 for a version compatible with Magento 2
113 stars 53 forks source link

PHP 8.1 compatiblity & Magento 2 tables update (utilities) #108

Open xtremevision opened 1 year ago

xtremevision commented 1 year ago

Fixed:

xtremevision commented 1 year ago

Apologies, it's been a while since I made that fix, but if memory serves me right, it was because I experience great difficulties importing remote images. For some reason $dest was always "pub/pub" instead of just "pub" and even though the files got imported, they weren't being created/written in the right path, i.e. pub/media/catalog/product/...

I am more than happy to fix it at source if you prefer, i.e. where getRemoteFile()  is being called (or higher up), but this fix seemed the easiest/quickest, and safest.

Example of import csv:

"sku","type","name","url_key","description","short_description","categories","status","store","websites","attribute_set","retail_price","price","check_by_mail_price","ebay_auction_price","ebay_store_price","base _price","real_time_base_price_formula","material_content","material_price","material_price_date","live_pricing","margin_percent","markup_percent","mule","currency_other","currency_fr_number","currency_denominati on","currency_date_series","currency_type","currency_star","currency_error","currency_nbn_title","currency_nbn_city","currency_nbn_state","currency_nbn_ch","cc_material","cc_mintcode","is_ebay_item","is_collecto rs_corner_item","upc","cost","qty","meta_keyword","is_in_stock","visibility","tax_class_id","manage_stock","use_config_manage_stock","notify_stock_qty","max_sale_qty","qty_increments","cd_certification","cc_cert ificatenumber","grade","prefix_grade","cc_grade","cc_gradingservice","cd_denomination","cd_mintmark","cd_luster","cd_year","material","cd_condition","cd_eyeappeal","cd_cleaned","cd_strike","cd_description","is_b argain_bin","manufacturer","image","small_image","thumbnail","media_gallery" "BBDM13957","simple","1921-P Morgan Silver Dollar - ERROR Struck Thru","1921-p-morgan-silver-dollar-error-struck-thru-bbdm13957","","","Coins by Type/U.S. Dollars (1794-Present)/U.S. Morgan Dollars (1878-1904, 1 921)","1","default","base","COINSBARGAINBIN","47.00000","40.00000","39.00000","41.00000","41.00000","37.00000","","","","","0","45","81","","","","","","","","","","","","","Silver","P","1","1","","25.90000","1. 00000","1921-P, 247898, Do, Dollar, ERROR, Morgan, Silver, Struck, Thru","1","Catalog, Search","None","1","1","1","10000","1","","","","","","","Morgan Silver Dollar","P","","1921","Silver","Circulated","","","" ,"","1","US Mint","http://url.com/IMAGES/2-23 FEBRUARY/021 BARGAIN BIN/011 DOLLARS/04 MORGAN/BBDM13957_1.PNG","http://url.com/IMAGES/2-23 FEBRUARY/021 BARGAIN BIN/011 DOLLAR S/04 MORGAN/BBDM13957_1.PNG","http://url.com/IMAGES/2-23 FEBRUARY/021 BARGAIN BIN/011 DOLLARS/04 MORGAN/BBDM13957_1.PNG","http://url.com/IMAGES/2-23 FEBRUARY/021 BARGAIN BIN /011 DOLLARS/04 MORGAN/BBDM13957_2.PNG"

magmi is installed in pub/magmi

the import file is in pub/import/import.csv

On 28/08/2023 03:31, Tymoteusz Motylewski wrote:

@.**** commented on this pull request.


In magmi/inc/remotefilegetter.php https://github.com/macopedia/magmi-m2/pull/108#discussion_r1307020610:

@@ -262,6 +262,8 @@ public function getRemoteFile($url, $dest, $authmode = null, $cookies = null) $context = $this->createContext($url); $ch = $context['curlhandle']; $dl_opts = $context['opts']['dl']; +

  • $dest = str_replace("pub/pub", "pub", $dest);

what is this change for?

— Reply to this email directly, view it on GitHub https://github.com/macopedia/magmi-m2/pull/108#pullrequestreview-1597644479, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR3CEWUU74ZBXA6MWISWYTXXRCLNANCNFSM6AAAAAA362VSMU. You are receiving this because you authored the thread.Message ID: @.***>

--

Michael Mussulis

mobilePhone

+ 1 772 418 3463 <tel:+%201%20772%20418%203463>

emailAddress

***@***.*** ***@***.***>

website

https://www.linkedin.com/in/michaelmussulis/ 

https://www.linkedin.com/in/michaelmussulis/

xtremevision commented 1 year ago

Done.

On 28/08/2023 03:31, Tymoteusz Motylewski wrote:

@.**** commented on this pull request.


In magmi/plugins/extra/itemprocessors/imageprocessor/imageitattributeemprocessor.php https://github.com/macopedia/magmi-m2/pull/108#discussion_r1307021410:

@@ -482,13 +483,19 @@ public function copyImageFile($imgfile, &$item, $extra) // magento image value (relative to media catalog) $impath = "/$i1/$i2/$bimgfile"; // target directory;

  • $l2d = "pub/media/catalog/product/$i1/$i2";
  • if(!strstr(getcwd(), "pub"))

please add brackets around "if" body and "else" body

— Reply to this email directly, view it on GitHub https://github.com/macopedia/magmi-m2/pull/108#pullrequestreview-1597645724, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR3CETLPYFWOVLT6YPUW33XXRCORANCNFSM6AAAAAA362VSMU. You are receiving this because you authored the thread.Message ID: @.***>

--

Michael Mussulis

mobilePhone

+ 1 772 418 3463 <tel:+%201%20772%20418%203463>

emailAddress

***@***.*** ***@***.***>

website

https://www.linkedin.com/in/michaelmussulis/ 

https://www.linkedin.com/in/michaelmussulis/

xtremevision commented 1 year ago

Done.

On 28/08/2023 03:32, Tymoteusz Motylewski wrote:

@.**** commented on this pull request.


In magmi/plugins/utilities/clearproducts/clearproduct.php https://github.com/macopedia/magmi-m2/pull/108#discussion_r1307022223:

@@ -38,7 +58,8 @@ public function runUtility() }

      //clean url rewrites for products
  • $sql = "DELETE FROM ".$this->tablename("core_url_rewrite")." WHERE product_id IS NOT NULL AND is_system=1";
  • //$sql = "DELETE FROM ".$this->tablename("core_url_rewrite")." WHERE product_id IS NOT NULL AND is_system=1";

please remove the comment

— Reply to this email directly, view it on GitHub https://github.com/macopedia/magmi-m2/pull/108#pullrequestreview-1597646996, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR3CETEKFTJFVODUP56VHTXXRCRRANCNFSM6AAAAAA362VSMU. You are receiving this because you authored the thread.Message ID: @.***>

--

Michael Mussulis

mobilePhone

+ 1 772 418 3463 <tel:+%201%20772%20418%203463>

emailAddress

***@***.*** ***@***.***>

website

https://www.linkedin.com/in/michaelmussulis/ 

https://www.linkedin.com/in/michaelmussulis/

xtremevision commented 1 year ago

No problem. Done and pushed.

On 28/08/2023 03:33, Tymoteusz Motylewski wrote:

@.**** requested changes on this pull request.

thanks for the patch. please fix some nitpics

— Reply to this email directly, view it on GitHub https://github.com/macopedia/magmi-m2/pull/108#pullrequestreview-1597647844, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR3CEWEKRG37INI7KDABQ3XXRCTPANCNFSM6AAAAAA362VSMU. You are receiving this because you authored the thread.Message ID: @.***>

--

Michael Mussulis

mobilePhone

+ 1 772 418 3463 <tel:+%201%20772%20418%203463>

emailAddress

***@***.*** ***@***.***>

website

https://www.linkedin.com/in/michaelmussulis/ 

https://www.linkedin.com/in/michaelmussulis/

tmotyl commented 1 year ago

there are plenty of error_log() calls, seems like they are a leftover from debugging?

xtremevision commented 1 year ago

Yes, I did have lots of error_log() calls but I removed them when I did committed. And I did 2 more commits after the first one. I just checked again and I can see I missed some. I'll clean them up and commit.

On 08/09/2023 04:39, Tymoteusz Motylewski wrote:

there are plenty of error_log() calls, seems like they are a leftover from debugging?

— Reply to this email directly, view it on GitHub https://github.com/macopedia/magmi-m2/pull/108#issuecomment-1711297046, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR3CETTK5IK3MSID77TJ6DXZLKTNANCNFSM6AAAAAA362VSMU. You are receiving this because you authored the thread.Message ID: @.***>

--

Michael Mussulis

mobilePhone

+ 1 772 418 3463 <tel:+%201%20772%20418%203463>

emailAddress

***@***.*** ***@***.***>

website

https://www.linkedin.com/in/michaelmussulis/ 

https://www.linkedin.com/in/michaelmussulis/

xtremevision commented 1 year ago

Done. Please check now.

On 08/09/2023 04:39, Tymoteusz Motylewski wrote:

there are plenty of error_log() calls, seems like they are a leftover from debugging?

— Reply to this email directly, view it on GitHub https://github.com/macopedia/magmi-m2/pull/108#issuecomment-1711297046, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR3CETTK5IK3MSID77TJ6DXZLKTNANCNFSM6AAAAAA362VSMU. You are receiving this because you authored the thread.Message ID: @.***>

--

Michael Mussulis

mobilePhone

+ 1 772 418 3463 <tel:+%201%20772%20418%203463>

emailAddress

***@***.*** ***@***.***>

website

https://www.linkedin.com/in/michaelmussulis/ 

https://www.linkedin.com/in/michaelmussulis/