provide support for special prices in admin orders#431
Conversation
if your item has special prices, the offer will display accordingly.
WalkthroughThe warranty order item template has been modified to pass pricing information to the JavaScript warranty offer renderer. The change retrieves the warranty quote item price via Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
view/adminhtml/templates/order/create/items/warranty.phtml (1)
14-15: Prefer integer cents conversion over float round-tripThis works, but converting cents back to
floatis unnecessary and can introduce precision edge cases. Keep cents asint.Proposed refactor
- $rawPrice = (float)$_item->getPrice(); - $priceInCents = (float)number_format($rawPrice, 2, '', ''); + $rawPrice = (float) $_item->getPrice(); + $priceInCents = (int) round($rawPrice * 100);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@view/adminhtml/templates/order/create/items/warranty.phtml` around lines 14 - 15, The current conversion uses number_format and casts back to float which can introduce precision issues; update the logic that computes $rawPrice (from $_item->getPrice()) so $priceInCents is an integer by multiplying the numeric price by 100, rounding to nearest cent, and casting to int (e.g., use round(...) then (int) or intval) instead of using number_format and a float; ensure $priceInCents remains an int throughout any downstream use.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@view/adminhtml/templates/order/create/items/warranty.phtml`:
- Around line 14-15: The current conversion uses number_format and casts back to
float which can introduce precision issues; update the logic that computes
$rawPrice (from $_item->getPrice()) so $priceInCents is an integer by
multiplying the numeric price by 100, rounding to nearest cent, and casting to
int (e.g., use round(...) then (int) or intval) instead of using number_format
and a float; ensure $priceInCents remains an int throughout any downstream use.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 83fa3ec9-6678-4558-b86f-f4f204e22642
📒 Files selected for processing (1)
view/adminhtml/templates/order/create/items/warranty.phtml
if your item has special prices, the offer will display accordingly.
Summary by CodeRabbit