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,70 @@
<?php
namespace Lts\Catalog\Pricing\Render;
use Lts\Customer\Model\Netsuite\Status;
use Magento\Catalog\Model\Product\Pricing\Renderer\SalableResolverInterface;
use Magento\Catalog\Pricing\Price\MinimalPriceCalculatorInterface;
use Magento\Customer\Model\Session;
use Magento\Framework\Pricing\Price\PriceInterface;
use Magento\Framework\Pricing\Render\RendererPool;
use Magento\Framework\Pricing\SaleableInterface;
use Magento\Framework\View\Element\Template\Context;
class FinalPriceBox extends \Magento\Catalog\Pricing\Render\FinalPriceBox
{
protected Session $customerSession;
public function __construct(
Context $context,
SaleableInterface $saleableItem,
PriceInterface $price,
RendererPool $rendererPool,
Session $customerSession,
array $data = [],
SalableResolverInterface $salableResolver = null,
MinimalPriceCalculatorInterface $minimalPriceCalculator = null
) {
parent::__construct(
$context,
$saleableItem,
$price,
$rendererPool,
$data,
$salableResolver,
$minimalPriceCalculator
);
$this->customerSession = $customerSession;
}
protected function isShowPrice(): bool
{
$customerSession = $this->customerSession;
if ($customerSession->isLoggedIn()) {
$customer = $customerSession->getCustomer();
$dataCustomer = $customer->getDataModel();
$netsuiteStatus = $dataCustomer->getExtensionAttributes()?->getNetsuiteStatus();
$netsuiteStatus = $netsuiteStatus? strtolower($netsuiteStatus):$customer->getNetsuiteStatus();
if (!$netsuiteStatus) {
return false;
}
if ($netsuiteStatus!==null) {
$netsuiteStatus = strtolower($netsuiteStatus);
}
if (in_array($netsuiteStatus, Status::getApprovedStatuses())) {
return true;
}
}
return false;
}
protected function _toHtml()
{
if (!$this->isShowPrice()) {
return '';
}
return parent::_toHtml(); // TODO: Change the autogenerated stub
}
}
@@ -0,0 +1,71 @@
<?php
namespace Lts\Catalog\Pricing\Render;
use Lts\Customer\Model\Netsuite\Status;
use Magento\Catalog\Model\Product;
use Magento\Customer\Model\Session;
use Magento\Framework\Json\Helper\Data;
use Magento\Framework\Math\Random;
use Magento\Framework\Pricing\Price\PriceInterface;
use Magento\Framework\Pricing\Render\RendererPool;
use Magento\Framework\View\Element\Template\Context;
class PriceBox extends \Magento\Catalog\Pricing\Render\PriceBox
{
protected Session $customerSession;
public function __construct(
Context $context,
Product $saleableItem,
PriceInterface $price,
RendererPool $rendererPool,
Data $jsonHelper,
Random $mathRandom,
Session $customerSession,
array $data = []
) {
parent::__construct(
$context,
$saleableItem,
$price,
$rendererPool,
$jsonHelper,
$mathRandom,
$data
);
$this->customerSession = $customerSession;
}
protected function isShowPrice(): bool
{
$customerSession = $this->customerSession;
if ($customerSession->isLoggedIn()) {
$customer = $customerSession->getCustomer();
$dataCustomer = $customer->getDataModel();
$netsuiteStatus = $dataCustomer->getExtensionAttributes()?->getNetsuiteStatus();
$netsuiteStatus = $netsuiteStatus? strtolower($netsuiteStatus):$customer->getNetsuiteStatus();
var_dump($netsuiteStatus);
if (!$netsuiteStatus) {
return false;
}
if ($netsuiteStatus!==null) {
$netsuiteStatus = strtolower($netsuiteStatus);
}
if (in_array($netsuiteStatus, Status::getApprovedStatuses())) {
return true;
}
}
return false;
}
protected function _toHtml()
{
if (!$this->isShowPrice()) {
return '';
}
return parent::_toHtml();
}
}