6

I am creating a fixtures yaml file to create a sample product for my unit tests - using the EcomDev phpunit plugin for Magento.

The issue is that I need to set store specific values for price. I have managed to get this working fine for website specific values like so:

eav:
  catalog_product:
    - entity_id: 1
      type_id: simple
      sku: book
      name: Book
      short_description: Book
      description: Book
      url_key: book
      price: 12.99
      tax_class_id: 2
      status: 1
      visibility:
      /websites:
        uk: # this is the website code
          price: 12.99

However when I try with stores instead of websites at the bottom, the store specific values are not being set:

/stores:
  artista_uk: # this store does exist in the database
    price: 16.99

The way I have tested this is by viewing the catalog_product_entity_decimal table and seeing if a price value appears next to the relevant store id.

The documentation can be found here:
http://www.ecomdev.org/wp-content/uploads/2011/05/EcomDev_PHPUnit-0.2.0-Manual.pdf
Which does say you can interchange websites with stores

Any ideas would be great.

Thanks.

  • 1
    Are you sure that artista_uk is code of store not store_group? This should work – kuba_ceg Feb 4 '14 at 8:59
4

I don't think you can accomplish to do that because price in Magento is limited to global or website scope.

As far as I know, no different prices can be set on same product for different store views belonging to same website.

Kind regards

  • Additionally you have to set the config value to use the website scope, if you don't do this, the website price is ignored! See \Mage_Catalog_Model_Product_Attribute_Backend_Price::setScope – Fabian Blechschmidt Feb 12 '14 at 22:57
  • To Fabian's point, you can also set this inside the fixture: config: default/catalog/price/scope: 1 # Set price scope to website – Ariel Allon Nov 12 '14 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.