Prijzen in bulk aanpassen (Drupal Commerce)

Uit De Vliegende Brigade
Versie door Jeroen Strompf (overleg | bijdragen) op 8 jun 2018 om 14:02 (→‎Database-niveau - Test)
(wijz) ← Oudere versie | Huidige versie (wijz) | Nieuwere versie → (wijz)
Naar navigatie springen Naar zoeken springen

Inventaris

Op database-niveau

Waarschijnlijk moet je dan twee tabellen aanpassen + join om de juiste artikelen te identificeren:

  • field_data_commerce_price
  • field_revision_commerce_price

VBO

Mbv. VBO - Gedoe + per pagina moet je akkoord geven [1]

Commerce Feeds

Mbv. Commerce Feeds [2]

Database-niveau

Kijk & huiver:

##########################################
# Update field
##########################################

# Test
###############
#
# select
# 
#     field_data_commerce_price.commerce_price_amount,
#     commerce_product.product_id, 
#     commerce_product.revision_id, 
#     commerce_product.sku, 
#     commerce_product.title
#     
# from field_data_commerce_price
# join commerce_product on field_data_commerce_price.entity_id = commerce_product.product_id
# 
# where type like "product";

# Update
#########
#
update field_data_commerce_price
join commerce_product on field_data_commerce_price.entity_id = commerce_product.product_id

set field_data_commerce_price.commerce_price_amount = 1.1* field_data_commerce_price.commerce_price_amount
	
where type like "product";

##########################################
# Update revision
##########################################

# Test
##############
#
# select
# 
#     field_revision_commerce_price.commerce_price_amount,
#     commerce_product.product_id, 
#     commerce_product.revision_id, 
#     commerce_product.sku, 
#     commerce_product.title
#     
# from field_revision_commerce_price
# join commerce_product on field_revision_commerce_price.entity_id = commerce_product.product_id
# 
# where type like "product";

# Update
########
#
update field_revision_commerce_price
join commerce_product on field_revision_commerce_price.entity_id = commerce_product.product_id

set field_revision_commerce_price.commerce_price_amount = 1.1* field_revision_commerce_price.commerce_price_amount
	
where type like "product";