-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Product] Add a crossed price #3373
Conversation
Does 'crossed price' mean 'original price'? The naming feels a bit confusing |
It means "overpriced" as amazon, banggood and others brands do. It's commonly used to convince customers it's a good deal. Sorry for the confusion I edited the description. |
I think the most common term, at least in my experience, is MSRP. |
Nice work Tristan! I'd like to hear more opinions about the naming. :) |
@@ -2,6 +2,9 @@ | |||
<a href="{{ path(product) }}"><h4>{{ product.name|truncate(18) }}</h4></a> | |||
<a href="{{ path(product) }}"> | |||
<img class="img-rounded img-responsive" src="{{ product.image ? product.image.path|imagine_filter('sylius_medium') : 'http://placehold.it/262x255' }}" alt="{{ product.name }}" /> | |||
{% if (product.masterVariant.crossedprice != 0) %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the check here should be if crossedPrice > price, also I think this could be done in a macro as it's like you would want to display the price in this way in lots of places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put it inside the main span so that it could be used as a macro something like:
<span class="label label-primary">
{{ sylius_customer_product_price(variant) }}
</span>
Again not sure about naming, could be formatted_product_price()?
Then your markup might look something like:
<span class="label label-primary">
<span class="product-price"><span class="crossed">€40<span>€25</span>
</span>
Then you have something reusable and don't have to repeat the formatting that you've got below - do it once in the macro.
We have done something similar very similar in our project. We take this further with multiple PriceLists per product per channel. In this structure we have From a native English-speakers perspective, 'crossed price' isn't a known term. I actually like it because it's not committing to anything specific, it's just describing that it's the crossed-out price on the page, but still not really known and obvious.
So my vote would go for |
+1 for |
I would also look at logic on the |
Tank you all for your feedbacks. I updated my work and now crossed_price has been replaced by original_price as suggested. |
@@ -88,6 +88,7 @@ sylius: | |||
images: Images | |||
on_hand: Stock actuel | |||
price: Prix | |||
original_price: Prix original |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should modify only en
translations and then the translation process is handled on Crowdin (http://translate.sylius.org)
b3e2ed4
to
98340e2
Compare
@peteward @jimbocoder @pjedrzejewski @aramalipoor @michalmarcinkowski Do you see anything to edit or improve ? |
@@ -41,6 +41,7 @@ public function getFilters() | |||
return array( | |||
new \Twig_SimpleFilter('sylius_currency', array($this, 'convertAmount')), | |||
new \Twig_SimpleFilter('sylius_price', array($this, 'convertAndFormatAmount')), | |||
new \Twig_SimpleFilter('sylius_original_price', array($this, 'convertAndFormatAmount')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this and just use 'sylius_price' where you need to. I'm not sure that there's any point having 2 filters doing the same thing and it might even be misleading. I'm trying to think of a use-case for performing a different calculation on originalPrice compared to price and I can't think of one...
Looks good to me, ready for merge when rebase and we get a green light from Travis! 👍 Nice work @TristanPerchec! |
059f95d
to
6bf861b
Compare
I saw there's just one test that is not passing in travis. I'm pretty new to behat and i don't know if this error is linked to my PR. Can someone help me with this ? |
@TristanPerchec I quickly looked and not sure what's the problem, but our Travis scripts output failed scenarios to Termbin. You can have a look here - http://termbin.com/9158. Maybe it will give you some clue. |
} | ||
|
||
/** | ||
* {@inheritdoc} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no inherited doc for recently added method, these methods should be added to ProductVariantInterface
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@TristanPerchec it has something in common with channel-based pricing. If you take a look at Sylius/features/frontend/products.feature Line 22 in 177d653
WEB-EU channel which is €15.99.
Anyway, @Zales0123 it would be nicer and cleaner, if that assumption checked that "Super T-Shirt" has price "€15.99" instead of searching for "Super T-Shirt" and "€15.99" independently. |
<div class="product-box"> | ||
<a href="{{ path(product) }}"><h4>{{ product.name|truncate(18) }}</h4></a> | ||
<a href="{{ path(product) }}"> | ||
<img class="img-rounded img-responsive" src="{{ product.image ? product.image.path|imagine_filter('sylius_medium') : 'http://placehold.it/262x255' }}" alt="{{ product.name }}" /> | ||
<span class="label label-primary">{{ sylius_calculate_price(product.masterVariant)|sylius_price }}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to your error, you do not call sylius_calculate_price()
in your macro. Moreover, current isReduced
method in ProductVariant
isn't aware of price calculator, so those channel differences are not processed (and it may introduce some errors if for some channel price is higher than regular price).
@pamil Sure, you're right! 👍 I will fix in the nearest future (at least I hope so ;)). |
@TristanPerchec any update on this ? |
@nakashu Sorry got a lot of work lately. Maybe I will be able to work on it in the future but I can't right now. |
@TristanPerchec No worries, thanks for letting us know. Anyone willing to pick up this PR? :) |
Related issue #1812 |
@pjedrzejewski I can pick up this PR if you want. I need this feature in a project at work so I have to write it anyways. Just tell me if I should work on core or extending model only for my own usages. |
@starspire Sounds great, please open a new PR on top of this branch. 👍 Thanks! |
This one can be closed, well done @TristanPerchec on your foundation work here. |
Well thanks to all of you for helping me on the work I did. |
Yes, thank you Tristan a lot! 👍 |
Added a crossed price attribute on every variant.
It works as amazon system price :
This development was sponsorised by Store Factory