The patch:
- Adds a markup widget. After creating field_cost for variation, change this field's widget to 'Price with Cost'. Select the necessary fields from widget settings.
- On variation edit page, when a value for `Markup`, or `Cost` field is changed, a UX is presented to let the user know of altered values.
See attached
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | Screen Shot 2018-01-12 at 17.03.49.png | 4.08 KB | gauravjeet |
| #4 | interdiff.txt | 4.02 KB | gauravjeet |
| #4 | add-markup-widget-2933790.patch | 7.49 KB | gauravjeet |
| #2 | widget-ux.gif | 5.01 MB | gauravjeet |
| #2 | widget-edit.gif | 6.86 MB | gauravjeet |
Comments
Comment #2
gauravjeet commentedComment #3
travis-bradbury commentedThanks, Gaurav. Looks great so far.
Shouldn't the
@filedoc be at the top of the file?Why not add this element in the widget? Then we can use the form api instead of manually adding markup that is the responsibility of the theme.
Toggle a class here instead of setting the colour directly.
The code is duplicated in the event listener for
$price. How about passing$markupor$priceNumberinto a function that does the animation?// \Drupal::logger('abcd')->notice('<pre>' . print_r($element, TRUE) . '</pre>');This debugging code should be removed.
Comment #4
gauravjeet commented@Travis
I've made edits to the patch. New patch attached with interdiff.
Attaching the markup field within
$formof widget will not allow putting cost and markup together and thats not going to be a nice UX. Placing the markup field depends on the#weightproperty and thats not going to same for every site. screenshot attached for reference.Comment #5
gauravjeet commentedAdd version tag
Comment #7
travis-bradbury commented