Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function getCatalogPrice(\Magento\Catalog\Model\Product $product, \Magento\Store\Api\Data\StoreInterface $store = null, $inclTax = false)
 {
     // Workaround to avoid loading stock status by admin's website
     if ($store instanceof \Magento\Store\Api\Data\StoreInterface) {
         $currentStore = $this->storeManager->getStore();
         $this->storeManager->setCurrentStore($store->getId());
     }
     $subProducts = $product->getTypeInstance()->getAssociatedProducts($product);
     if ($store instanceof \Magento\Store\Api\Data\StoreInterface) {
         $this->storeManager->setCurrentStore($currentStore->getId());
     }
     if (!$subProducts) {
         return null;
     }
     $minPrice = null;
     foreach ($subProducts as $subProduct) {
         $subProduct->setWebsiteId($product->getWebsiteId())->setCustomerGroupId($product->getCustomerGroupId());
         if ($subProduct->isSalable()) {
             if ($this->commonPriceModel->getCatalogPrice($subProduct) < $minPrice || $minPrice === null) {
                 $minPrice = $this->commonPriceModel->getCatalogPrice($subProduct);
                 $product->setTaxClassId($subProduct->getTaxClassId());
             }
         }
     }
     return $minPrice;
 }
 /**
  * @param \Magento\Store\Api\Data\StoreInterface $store
  * @return $this
  */
 public function setOriginStore(StoreInterface $store)
 {
     if (null === $this->originStoreId) {
         $this->originStoreId = $store->getId();
         $this->originWebsiteId = $store->getWebsiteId();
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function getCatalogPrice(\Magento\Catalog\Model\Product $product, \Magento\Store\Api\Data\StoreInterface $store = null, $inclTax = false)
 {
     if ($store instanceof \Magento\Store\Api\Data\StoreInterface) {
         $currentStore = $this->storeManager->getStore();
         $this->storeManager->setCurrentStore($store->getId());
     }
     $this->coreRegistry->unregister('rule_data');
     $this->coreRegistry->register('rule_data', new \Magento\Framework\DataObject(['store_id' => $product->getStoreId(), 'website_id' => $product->getWebsiteId(), 'customer_group_id' => $product->getCustomerGroupId()]));
     $minPrice = $product->getPriceModel()->getTotalPrices($product, 'min', $inclTax);
     if ($store instanceof \Magento\Store\Api\Data\StoreInterface) {
         $this->storeManager->setCurrentStore($currentStore->getId());
     }
     return $minPrice;
 }
 /**
  * @param TextTable      $table
  * @param StoreInterface $store
  * @param                $message
  * @param bool|false     $appendIfUnregistered
  * @return bool
  */
 private function addToTable(TextTable $table, StoreInterface $store, $message, $appendIfUnregistered = false)
 {
     $springbotStoreId = $this->storeConfig->getSpringbotStoreId($store->getId());
     $springbotGuid = strtolower($this->storeConfig->getGuid($store->getId()));
     if ($springbotStoreId && $springbotGuid || $appendIfUnregistered) {
         $table->appendRow([substr($store->getName(), 0, 23), $store->getId(), $springbotStoreId, $message]);
         return true;
     }
     return false;
 }
Exemplo n.º 5
0
 /**
  * Get details for GetTaxRequest
  *
  * @param \Magento\Store\Api\Data\StoreInterface $store
  * @param $address \Magento\Quote\Api\Data\AddressInterface|\Magento\Sales\Api\Data\OrderAddressInterface
  * @param \Magento\Quote\Api\Data\CartInterface|\Magento\Sales\Api\Data\OrderInterface $object
  * @return array
  * @throws LocalizedException
  */
 protected function retrieveGetTaxRequestFields(StoreInterface $store, $address, $object)
 {
     $customerId = $object->getCustomerId();
     $customer = $this->getCustomerById($customerId);
     $storeId = $store->getId();
     if ($this->config->getLiveMode() == Config::API_PROFILE_NAME_PROD) {
         $companyCode = $this->config->getCompanyCode($storeId);
     } else {
         $companyCode = $this->config->getDevelopmentCompanyCode($storeId);
     }
     $businessIdentificationNumber = $this->getBusinessIdentificationNumber($store, $address, $customer);
     $locationCode = $this->config->getLocationCode($store);
     return ['BusinessIdentificationNo' => $businessIdentificationNumber, 'CompanyCode' => $companyCode, 'LocationCode' => $locationCode, 'OriginAddress' => $this->address->getAddress($this->config->getOriginAddress($storeId))];
 }