Class: Gemgento::Magento::ProductAttributeSetsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Gemgento::Magento::ProductAttributeSetsController
- Defined in:
- app/controllers/gemgento/magento/product_attribute_sets_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#destroy ⇒ Object
28 29 30 31 32 33 |
# File 'app/controllers/gemgento/magento/product_attribute_sets_controller.rb', line 28 def destroy @product_attribute_set = ProductAttributeSet.find_by(magento_id: params[:id]) @product_attribute_set.mark_deleted! unless @product_attribute_set.nil? render nothing: true end |
#update ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/gemgento/magento/product_attribute_sets_controller.rb', line 5 def update data = params[:data] @product_attribute_set = ProductAttributeSet.find_or_initialize_by(magento_id: params[:id]) @product_attribute_set.magento_id = data[:set_id] @product_attribute_set.name = data[:name] @product_attribute_set.save unless data[:attributes].nil? data[:attributes].each do |magento_id| attribute = ProductAttribute.find_by(magento_id: magento_id) unless attribute.nil? @product_attribute_set.product_attributes << attribute unless @product_attribute_set.product_attributes.include?(attribute) end end end API::SOAP::Catalog::ProductAttributeMedia.fetch_all_media_types render nothing: true end |