Skip to content

provide support for special prices in admin orders#431

Merged
jm-extend merged 1 commit into
masterfrom
admin-order-special-prices
Mar 23, 2026
Merged

provide support for special prices in admin orders#431
jm-extend merged 1 commit into
masterfrom
admin-order-special-prices

Conversation

@jm-extend

@jm-extend jm-extend commented Mar 23, 2026

Copy link
Copy Markdown
Collaborator

if your item has special prices, the offer will display accordingly.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected warranty item price calculation and formatting in order creation to ensure warranty quotes display accurate pricing information with proper decimal precision.

if your item has special prices, the offer will display accordingly.
@jm-extend jm-extend self-assigned this Mar 23, 2026
@coderabbitai

coderabbitai Bot commented Mar 23, 2026

Copy link
Copy Markdown

Walkthrough

The 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 getPrice(), formats it to two decimal places, converts it to float, and injects this value as a price parameter in the Extend.buttons.renderSimpleOffer configuration alongside the existing referenceId. The modification adds three lines and removes one, with no changes to control flow or public entity declarations.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
view/adminhtml/templates/order/create/items/warranty.phtml (1)

14-15: Prefer integer cents conversion over float round-trip

This works, but converting cents back to float is unnecessary and can introduce precision edge cases. Keep cents as int.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 26b96c3 and e7042bb.

📒 Files selected for processing (1)
  • view/adminhtml/templates/order/create/items/warranty.phtml

@jm-extend
jm-extend merged commit a29c7f3 into master Mar 23, 2026
7 checks passed
@jm-extend
jm-extend deleted the admin-order-special-prices branch March 23, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants