Hi,
Is this feature in the backlog? If so, lets discuss it and we will send a PR.
In #6774 this feature was removed in order to introduce ChannelPricing
Specs that were deleted and we need to recover:
Scenarios:
# features/product/managing_products/editing_product.feature
Scenario: Changing a simple product price
Given I want to modify the "Dice Brewing" product
When I change its original price to "$25.00" and price to "$15.00" for "United States" channel
And I save my changes
Then I should be notified that it has been successfully edited
And it should be priced at $15.00 with $10.00 discount included for channel "United States"
# features/product/viewing_products/viewing_product_price_on_products_list.feature
Scenario: Viewing products with discounted price on list
Given the store has a product "T-shirt watermelon" priced at "$19.00" with "$10.00" included
And the store classifies its products as "T-Shirts"
And this product belongs to "T-Shirts"
When I browse products from taxon "T-Shirts"
Then I should see the product "T-shirt watermelon" with price "$19.00" and "$29.00" should have a strikethrough
# features/product/viewing_products/viewing_product.feature
Scenario: Viewing a detailed page with a discounted product price
Given the store has a product "T-shirt watermelon" priced at "$19.00" with "$10.00" discount
When I check this product's details
Then I should see the product "T-shirt watermelon" with price "$19.00" and "$29.00" should have a strikethrough
# features/cart/shopping_cart/adding_product_to_cart_with_discounted_prices_dependent_on_channel.feature
@shopping_cart
Feature: Adding a product to cart with prices dependent on a channel and currency
In order to buy products in correct discounted prices
As a Customer
I want to add products to my cart with discounted prices dependent on visited channel and currency
Background:
Given the store has currency "EUR"
And the store has currency "GBP"
And the store operates on a channel named "Web-EU" in "EUR" currency
And that channel allows to shop using "EUR" and "GBP" currencies
And the store operates on another channel named "Web-GB" in "GBP" currency
And that channel allows to shop using "EUR" and "GBP" currencies
And the store has a product "Leprechaun's Gold" priced at "€10.00" with "€10.00" discount in "Web-EU" channel
And this product is also priced at "£15.00" with "£15.00" discount in "Web-GB" channel
And I am a logged in customer
Scenario: Buying a discounted product in default currency for browsed channel
Given I change my current channel to "Web-EU"
When I add product "Leprechaun's Gold" to the cart
Then I should see "Leprechaun's Gold" with unit price "€10.00" and "€20.00" should have a strikethrough in my cart
Scenario: Buying a product with proper discounted price after currency change
Given I change my current channel to "Web-EU"
And the exchange rate of "Euro" to "British Pound" is 0.7
When I switch to the "GBP" currency
And I add product "Leprechaun's Gold" to the cart
Then I should see "Leprechaun's Gold" with unit price "£7.00" and "£14.00" should have a strikethrough in my cart
Scenario: Buying a product with proper discounted price after channel change
Given I change my current channel to "Web-GB"
When I add product "Leprechaun's Gold" to the cart
Then I should see "Leprechaun's Gold" with unit price "£15.00" and "£30.00" should have a strikethrough in my cart
Implementation:
originalPrice field to ChannelPricing model and ChannelPricingType formAny considerations or comments are welcome.
PR will be more than appreciated! We definitely want to bring it back. :)
I actually half implemented this, but never committed back to Sylius mostly because I haven't written any tests yet
For some reason, the table that currently stores all the pricing for the product variant is called sylius_channel_pricing, which is pretty confusing, mostly because there is no indication that those are prices for product variants.
My implementation also has broken naming, which is part of the reason I haven't opened a PR. My entity is called OriginalPrice and the table is currently called sylius_channel_original_price. If you guys have naming suggestions, maybe I can commit what I have (without tests), and @gorkalaucirica can add the tests? :)
@inssein The implementation seems straightforward, just adding originalPrice field to ChannelPricing model should be enough. The "complexity", I guess is related to the tests... I will start working now on this feature, so in case I need help I will come back to you
Ah that is so much simpler. Not sure why I decided to create a whole new entity.
After some research I think that originalPrice approach might not be the best and logic to paint "strikethrough" price and its better to rely on promotions and somehow use a custom price calculator for catalog. That way, we take advantage of a great and already working promotion management.
All those promotions that are not coupon based will be taken into account to show discounted prices in catalog. I believe this will be a more flexible and powerful tool for marketing guys than using the "originalPrice".
WDYT about this approach?
@gorkalaucirica I think it can indeed be a good idea to be able to do just that. But sometimes people are just using it for display purposes only and it would be weird to have the wrong "original" price as the default price of a product. Atleast that is how I think about it.
@steffenbrem I see... maybe we need a hybrid approach on this one, having the display purposes "original" price and allow masive and rule based temporary discounts that show up on the catalog.
Right now the rule based promotion are working ok. But for example in a special day such a black friday, you may want to show in the catalog the prices with the original and discounted price without having to change the products one by one
@gorkalaucirica you are talking about something I call "catalogue promotion". imho, this feature / behavior should be togglable.
you don't want in a product listing view of 100 items to recursively call a service that calculates the price(s) for that product based on the catalogue promotions. especially if that service depends on a 3rd party to calculate taxes or profit margins. I've been in this hell, trust me, it's not funny at all.
sometimes, you just want to decide arbitrarily that a certain product has a certain price; eventually, on that base price (original and selling) craft some catalogue promotions
as far as I remember, @pjedrzejewski was saying something at some point about creating a plugin bundle that enables this catalogue promotion behavior.
why don't we keep it simple for 1.0.0 stable? price and originalPrice as arbitrary values decided by the operator, that are tied to a channel (following the strategy chosen for now) and on top of that, a plugin bundle that allows you to setup catalogue promotions. preferably, pre-calculating the prices and storing them in a key-value storage for rapid access for a certain amount of time.
to avoid manual changing of prices product by product, we have developed a basic CSV upload form that allows the operators to change price, originalPrice and VAT. plain, stupid, improvable, but does the job for now.
Thanks @gabiudrescu for your comment. Finally we took a similar approach.
We have the code from #7087 in a separate bundle and we have created a new channel for the sales period. With a command we iterate across all products and we apply discounts based in the rules given to us, copying the prices from the source channel to the sales channel.
Maybe we can test this approach in a separate bundle with some fancy UI to make it easier for non technical admins. But we will still need the original price field.
I have stopped the PR because how to implement this scenario was unclear. I can continue with the development if you agree and later we may work in the bundle/plugin capable of catalog promotions.
WDYT?
@gorkalaucirica I must admit, your approach with multiple channels sounds very interesting and pretty clean / straightforward.
probably after this holiday season your PR will get some traction and make it to master.
Original price was brought back in #7087.
Most helpful comment
@inssein The implementation seems straightforward, just adding
originalPricefield toChannelPricingmodel should be enough. The "complexity", I guess is related to the tests... I will start working now on this feature, so in case I need help I will come back to you