ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.stock.sku">
<block class="Magento\Catalog\Block\Product\View" name="product.info.stock.details" as="product_info_stock_details" template="JR_Inventory::product/view/stock_details.phtml">
<arguments>
<argument name="view_model" xsi:type="object">JR\Inventory\ViewModel\StockDetailsViewModel</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,25 @@
<?php
/** @var JR\Inventory\ViewModel\StockDetailsViewModel $viewModel */
$viewModel = $block->getData('view_model');
if ($viewModel) {
// $sku = $block->getProduct()->getSku();
$stockDetails = $viewModel->getStockDetails($block->getProduct());
$stockStatus = $stockDetails['status'];
if ($stockDetails['show']) {
echo "<div>{$stockStatus}: {$stockDetails['total']}</div>";
} else {
echo "<div>{$stockStatus}</div>";
}
// Output the stock data as needed
if ($stockDetails['show']) {
foreach ($stockDetails['data'] as $source => $details) {
if ($details['quantity'] == 0) {
continue;
}
echo "<div>{$source}: {$details['quantity']}</div>";
}
}
}