Needs review
Project:
Commerce Price Rule
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Aug 2017 at 23:33 UTC
Updated:
14 Feb 2020 at 06:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sorabh.v6Comment #3
sorabh.v6Patchfile uploaded for field formatter. This formatter shows customised price i.e. it shows striked default price and next to it shows new price. I tried to show 'reason for the customised price' as required in the issue summary but I think for 'reason for the customised price' we will need a new field in price rule entity. @krystalcode What do you suggest?
Comment #4
sorabh.v6Comment #5
subhojit777I think it should be
$item->getEntity()Can we mention the data type here.
Can we mention the data type here as well.
It is recommended to use
#plain_texthere, orXss::filterAdmin()Comment #6
sorabh.v6@subhojit777 I referred this code from the price module`s PriceCalculatedFormatter. These things are there as it is. But if you still think that this patch needs your mentioned changes then I will do it.
Comment #7
subhojit777Comment #8
subhojit777I am quite sure about this one. Rest of them are code improvements, and writing more secure code.
Comment #9
sorabh.v6See its $items provided in viewElements() method as argument. Therefore, I will need to change that argument to $item is I make change suggested by you. Its same as in PriceCalculatedFormatter.
Comment #10
subhojit777I am talking about the
$itemin the loopforeach ($items as $delta => $item)Comment #11
sorabh.v6As per discussion with @subhojit777 over the chat -
This hunk of code should be outside of the loop.
New patch contains above changes. Please review.
Comment #12
subhojit777Since cache tag only dependes on
$purchasable_entity, therefore it can be created as an array variable outside the loop. We can then just use the variable in#cacheComment #13
sorabh.v6Patch updated with changes mentioned in #12. Please review.
Comment #14
subhojit777Patch looks good to me.
Comment #15
mrpauldriver commentedThis looks interesting. Can it be used yet?
Comment #16
jwwj commentedOld thread, so probably not valid anymore. But just thought I'd mention the patch in #13 does not work for me. Failed with
This against the 1.0@alpha version. I did a quick check and the PriceCalculatedFormatter class that this patch extends does not have a field called currencyStorage, so that's probably why the null pointer exception. Seems the base repository has moved on since this patch was created...
Comment #17
daniel korte#16 should be fixed. Also, the last patch did not check if there was a new price or not so it was possible for the formatter to show
$10$10. This new patch will use the parent formatter (“Calculated”) when there isn’t a cheaper price.