Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Check Data should validate gallery information #271

Closed
barbazul opened this Issue · 7 comments

3 participants

@barbazul

Current implementation ignores media gallery information during data check and then, if data is invalid (i.e. a row is missing the _media_attribute value) errors might occur.

I confirmed this bug in 1.7.0.2 and could not test in magento2 due to not having a PHP < 5.4 available at the moment. I did, however check magento2 code and it looks as if it is still there since there is no validation of media gallery data furing the first step and in app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php line 1275 it blindly assigns $insertValue['attribute_id'] to $valueArr['attribute_id'] which gets passed to the database "as is" in line 1281 and raises an SQL exception if its null

@piotrekkaminski
Collaborator

Hello. Would you be able to contribute a pull request with a fix?

@barbazul
@piotrekkaminski
Collaborator
@barbazul

Ok, I have a fix for the specific _media_attribute_id error. At this point I am wondering:

  1. Should the file be validated? Right now if file is missing its ignored during the import step (can't tell you how many headaches this has brought me) but I worry that checking it with file_exists would make the validation process too slow.
  2. Should the _media_attribute be validated as being the actual media_gallery attribute? Right now, if you provide a wrong attribute_id, it is saved into catalog_product_entity_media_gallery as it is provided, which creates rows that will never be accessed.
  3. Why is there even such a column? Looking at Mage_Catalog_Model_Product::addImageToMediaGallery, it specifically looks for the media_gallery attribute code (which obviously maps to an attribute_id later on). Why is there the need to specify the _media_attribute_id column? why not load the attribute, look for its id and use that? I am guessing the intention at some point was to have multiple media galleries for one product but, since the attribute code is hardwired into the models involved I guess that idea was abandoned
@barbazul barbazul referenced this issue from a commit in barbazul/magento2
@barbazul barbazul Fix #271.
Added _media_attribute_id validation during the first step of the import procoess
4a49e29
@piotrekkaminski
Collaborator
@barbazul

@piotrekkaminski Did you get a chance to look into this?

@magento-team magento-team referenced this issue from a commit
@magento-team magento-team 2.0.0.0-dev54
* Modularity improvements:
  * Breakdown of the Adminhtml module:
     * Moved Newsletter, Report logic to the respective modules
     * Moved blocks, config, view, layout files of other components from Adminhtml folder to respective modules
  * Removed application dependencies from the library
* Move Magento\Core common blocks in the library
* Application areas rework:
  * Areas are independent from Store
  * Removed deprecated annotation from the getArea methods
* GitHub requests:
  * [#245](#245) -- Resolve design flaws in core URL helper
  * [#247](#247) -- Bug in Mage_Page_Block_Html_Header->getIsHomePage
  * [#259](#259) -- Turkish Lira (TRY) is supported for Turkish members.
  * [#262](#262) -- Update Rule.php
  * [#373](#373) -- [Magento/Sales] Fixed typos
  * [#382](#382) -- [Magento/Core] Fixed typos
  * [#304](#304) -- Removed Erroneous closing "
  * [#323](#323) -- InstanceController.php - made setBody protected
  * [#349](#349) -- Move Mage_Catalog menu declaration into Mage_Catalog module.
  * [#265](#265) -- Update Merge.php
  * [#271](#271) -- Check Data should validate gallery information
  * [#305](#305) -- Extra ", tidied up nested quotes
  * [#352](#352) -- Add Croatia Country as part of European Union since 1st July 2013 for default european local countries in configuration
  * [#224](#224) -- Tax formatting is locale aware and should not
  * [#338](#338) -- Correcting SQL for required_options column
  * [#327](#327) -- cart api bug fix & partial invoice credit memo divide by zero warning
* Themes update:
  * Old frontend (magento_demo) and backend (magento_basic) themes are removed
  * Updated templates and layout updates in the Bundle, Catalog, CatalogInventory, CatalogSearch, Downloadable, ProductAlert, Reports, Sendfriend modules
* Fixed bugs:
  * Fixed the error when  Magento cannot be reinstalled to the same database with table prefix
  * Fixed report Products in Cart
  * Fixed error on attempt to insert image to CMS pages under version control
  * Fixed order status grid so that you can assign state, edit, and view custom order status
  * Fixed Related Products Rule page so that category can be selected on conditions tab
  * Fixed Magento_Paypal_Controller_ExpressTest integration test so it is re-enabled
  * Fixed the bug with international DHL quotes
6e24c0b
@verklov

Hello barbazul,
We have processed your pull request. The code is released in version dev54.

@verklov verklov closed this
@SchumacherFM SchumacherFM referenced this issue from a commit
@SchumacherFM SchumacherFM Merge remote-tracking branch 'upstream/master'
* upstream/master:
  2.0.0.0-dev54 * Modularity improvements:   * Breakdown of the Adminhtml module:      * Moved Newsletter, Report logic to the respective modules      * Moved blocks, config, view, layout files of other components from Adminhtml folder to respective modules   * Removed application dependencies from the library * Move Magento\Core common blocks in the library * Application areas rework:   * Areas are independent from Store   * Removed deprecated annotation from the getArea methods * GitHub requests:   * [#245](#245) -- Resolve design flaws in core URL helper   * [#247](#247) -- Bug in Mage_Page_Block_Html_Header->getIsHomePage   * [#259](#259) -- Turkish Lira (TRY) is supported for Turkish members.   * [#262](#262) -- Update Rule.php   * [#373](#373) -- [Magento/Sales] Fixed typos   * [#382](#382) -- [Magento/Core] Fixed typos   * [#304](#304) -- Removed Erroneous closing "   * [#323](#323) -- InstanceController.php - made setBody protected   * [#349](#349) -- Move Mage_Catalog menu declaration into Mage_Catalog module.   * [#265](#265) -- Update Merge.php   * [#271](#271) -- Check Data should validate gallery information   * [#305](#305) -- Extra ", tidied up nested quotes   * [#352](#352) -- Add Croatia Country as part of European Union since 1st July 2013 for default european local countries in configuration   * [#224](#224) -- Tax formatting is locale aware and should not   * [#338](#338) -- Correcting SQL for required_options column   * [#327](#327) -- cart api bug fix & partial invoice credit memo divide by zero warning * Themes update:   * Old frontend (magento_demo) and backend (magento_basic) themes are removed   * Updated templates and layout updates in the Bundle, Catalog, CatalogInventory, CatalogSearch, Downloadable, ProductAlert, Reports, Sendfriend modules * Fixed bugs:   * Fixed the error when  Magento cannot be reinstalled to the same database with table prefix   * Fixed report Products in Cart   * Fixed error on attempt to insert image to CMS pages under version control   * Fixed order status grid so that you can assign state, edit, and view custom order status   * Fixed Related Products Rule page so that category can be selected on conditions tab   * Fixed Magento_Paypal_Controller_ExpressTest integration test so it is re-enabled   * Fixed the bug with international DHL quotes
  2.0.0.0-dev53 * Moved general action-related functionality to \Magento\App\Action\Action in the library. Removed Magento\Core\Controller\Varien\Action and related logic from the Magento_Core module * Moved view-related methods from action interface to \Magento\App\ViewInterface with corresponding implementation * Moved redirect creation logic from the action interface to \Magento\App\Response\RedirectInterface * Moved Magento\Core common blocks to the library * Added reading of etc/integration/config.xml and etc/integration/api.xml files for API Integrations * Various improvements:   * Email-related logic from the Core and Adminhtml modules consolidated in the new Email module * GitHub requests:   * [#238](#238) -- Improve escaping HTML entities in URL   * [#199](#199) -- Replaced function calls to array_push with adding the elements directly   * [#182](#182) -- By default use collection _idFieldName for toOption* methods.   * [#233](#233) -- Google Rich Snippet Code   * [#339](#339) -- Correcting 'cahce' typo in documentation.   * [#232](#232) -- Update app/code/core/Mage/Checkout/controllers/CartController.php (fix issue #27632) * Fixed bugs:   * Fixed JavaScript error when printing orders from the frontend   * Fixed Captcha problems on various forms when Captcha is enabled on the frontend   * Fixed "Page not found" on category page if setting "Add Store Code to Urls" to "Yes" in the backend config   * Fixed Fatal error when creating shipping label for returns
  2.0.0.0-dev52 * Better Navigation menu rendering due to improved Caching of Categories * Added Magento\Filesystem\Directory and Magento\Filesystem\File to the library * Various improvements:   * Added a static test to check for incorrect dependencies in the library   * Moved Magento\Core\Model\Theme to the Magento\View component   * Moved Magento\Core\Model\Design to the Magento\View component   * Consistent declaration of page-types   * The Framework part of the Cache functionality moved out from modules * Themes update:   * Updated templates and layout updates in the Captcha, Customer, Newsletter, Persistent, ProductAlert, Wishlist modules; old files moved to the "magento-backup" theme   * Refactored and removed duplicate Persistent module templates   * Plushe theme made responsive * Fixed bugs:   * Fixed inability to print order, invoice, or creditmemo in the frontend   * Fixed fatal error caused by the Mage_Backend_Block_System_Config_FormTest integration test   * Fixed the broken link when the MAP feature is enabled and actual product price is set to be displayed in the shopping cart * Moved the following methods from Core Helpers to the appropriate libraries:   * Moved the Data Helper date format related functions to \Magento\Core\Model\Locale   * Moved the Data Helper array decoration related functions to Magento\Stdlib\ArrayUtils   * Moved the Data Helper functions that copy data from one object to another to \Magento\Object\Copy
4b15176
@Nas1k Nas1k referenced this issue from a commit
@magento-team magento-team 2.0.0.0-dev54
* Modularity improvements:
  * Breakdown of the Adminhtml module:
     * Moved Newsletter, Report logic to the respective modules
     * Moved blocks, config, view, layout files of other components from Adminhtml folder to respective modules
  * Removed application dependencies from the library
* Move Magento\Core common blocks in the library
* Application areas rework:
  * Areas are independent from Store
  * Removed deprecated annotation from the getArea methods
* GitHub requests:
  * [#245](#245) -- Resolve design flaws in core URL helper
  * [#247](#247) -- Bug in Mage_Page_Block_Html_Header->getIsHomePage
  * [#259](#259) -- Turkish Lira (TRY) is supported for Turkish members.
  * [#262](#262) -- Update Rule.php
  * [#373](#373) -- [Magento/Sales] Fixed typos
  * [#382](#382) -- [Magento/Core] Fixed typos
  * [#304](#304) -- Removed Erroneous closing "
  * [#323](#323) -- InstanceController.php - made setBody protected
  * [#349](#349) -- Move Mage_Catalog menu declaration into Mage_Catalog module.
  * [#265](#265) -- Update Merge.php
  * [#271](#271) -- Check Data should validate gallery information
  * [#305](#305) -- Extra ", tidied up nested quotes
  * [#352](#352) -- Add Croatia Country as part of European Union since 1st July 2013 for default european local countries in configuration
  * [#224](#224) -- Tax formatting is locale aware and should not
  * [#338](#338) -- Correcting SQL for required_options column
  * [#327](#327) -- cart api bug fix & partial invoice credit memo divide by zero warning
* Themes update:
  * Old frontend (magento_demo) and backend (magento_basic) themes are removed
  * Updated templates and layout updates in the Bundle, Catalog, CatalogInventory, CatalogSearch, Downloadable, ProductAlert, Reports, Sendfriend modules
* Fixed bugs:
  * Fixed the error when  Magento cannot be reinstalled to the same database with table prefix
  * Fixed report Products in Cart
  * Fixed error on attempt to insert image to CMS pages under version control
  * Fixed order status grid so that you can assign state, edit, and view custom order status
  * Fixed Related Products Rule page so that category can be selected on conditions tab
  * Fixed Magento_Paypal_Controller_ExpressTest integration test so it is re-enabled
  * Fixed the bug with international DHL quotes
789face
@Nas1k Nas1k referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@Nas1k Nas1k referenced this issue from a commit
@magento-team magento-team (split Module_Customer)2.0.0.0-dev54
* Modularity improvements:
  * Breakdown of the Adminhtml module:
     * Moved Newsletter, Report logic to the respective modules
     * Moved blocks, config, view, layout files of other components from Adminhtml folder to respective modules
  * Removed application dependencies from the library
* Move Magento\Core common blocks in the library
* Application areas rework:
  * Areas are independent from Store
  * Removed deprecated annotation from the getArea methods
* GitHub requests:
  * [#245](#245) -- Resolve design flaws in core URL helper
  * [#247](#247) -- Bug in Mage_Page_Block_Html_Header->getIsHomePage
  * [#259](#259) -- Turkish Lira (TRY) is supported for Turkish members.
  * [#262](#262) -- Update Rule.php
  * [#373](#373) -- [Magento/Sales] Fixed typos
  * [#382](#382) -- [Magento/Core] Fixed typos
  * [#304](#304) -- Removed Erroneous closing "
  * [#323](#323) -- InstanceController.php - made setBody protected
  * [#349](#349) -- Move Mage_Catalog menu declaration into Mage_Catalog module.
  * [#265](#265) -- Update Merge.php
  * [#271](#271) -- Check Data should validate gallery information
  * [#305](#305) -- Extra ", tidied up nested quotes
  * [#352](#352) -- Add Croatia Country as part of European Union since 1st July 2013 for default european local countries in configuration
  * [#224](#224) -- Tax formatting is locale aware and should not
  * [#338](#338) -- Correcting SQL for required_options column
  * [#327](#327) -- cart api bug fix & partial invoice credit memo divide by zero warning
* Themes update:
  * Old frontend (magento_demo) and backend (magento_basic) themes are removed
  * Updated templates and layout updates in the Bundle, Catalog, CatalogInventory, CatalogSearch, Downloadable, ProductAlert, Reports, Sendfriend modules
* Fixed bugs:
  * Fixed the error when  Magento cannot be reinstalled to the same database with table prefix
  * Fixed report Products in Cart
  * Fixed error on attempt to insert image to CMS pages under version control
  * Fixed order status grid so that you can assign state, edit, and view custom order status
  * Fixed Related Products Rule page so that category can be selected on conditions tab
  * Fixed Magento_Paypal_Controller_ExpressTest integration test so it is re-enabled
  * Fixed the bug with international DHL quotes
db39f5b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.