1
  1. Added 'from date' and 'to date' to Advance pricing model, tiUser can enter different different price for different price range, there may be cases like current date is lies between multiple rows

  2. I am writing custom rest api's on with some custom conditions. like

    $_productCollectionFactory = $this->_productCollectionFactory->create()
        ->addAttributeToSelect('*')
        //->setStoreId($storeId)
        ->addCategoriesFilter(['in' => $allCategoryIds])
        ->addAttributeToFilter('product_type', ['eq' => $productType])
        ->addAttributeToFilter('approval', ['in' => $this->productHelper->getAllowedApprovalStatus()])
        ->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
        ->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
        ->addFinalPrice()
        //->addMinimalPrice()
        ->distinct(true);
    
  3. List may have simple and configurable products.

  4. How can i calculate price, special price and per off with those tier price and product main price.

  5. Also in case of configurable there is no price or tier price with main product so in this case minimum main price from a active in_stock child product and minimum tier price from active and in_stock child product whose tier price from date <= current_date and to_date >= current_date

  6. Below is my previous code/conditions which i added to collection is as

    //price join
    $_productCollectionFactory->getSelect()->joinLeft(
      array('ad' => 'catalog_product_entity_decimal'), 
      "e.entity_id = ad.entity_id AND ad.attribute_id = '77' AND ad.store_id='".$storeId."'",
      [
       'product_price' => "ad.value"
      ]
    );
    $_productCollectionFactory->getSelect()->joinLeft(
      array('tier_price' => 'catalog_product_entity_tier_price'), 
      "e.entity_id = tier_price.entity_id AND from_date <= '".$todayStartOfDayDate."' AND to_date >= '".$todayEndOfDayDate."'",
      [
       'custom_special_price' => new \Zend_Db_Expr('IF(MIN(tier_price.value) > 0, MIN(tier_price.value), "")'),
       'final_pricea' => new \Zend_Db_Expr('IF(MIN(tier_price.value) <  ad.value, MIN(tier_price.value), ad.value)'),
       'per_off' => new \Zend_Db_Expr('IF(MIN(tier_price.value) <  ad.value, ((ad.value - MIN(tier_price.value)) * 100 )/ ad.value, 0)')
      ]
    );
    
    1. Above code is creating issue with configurable products, its not calculating configurable child product min tier price for current date if any.

    2. I want a solution which will work with above condition and also price sort and price layered navigation.

    3. Any solution, idea or a common place where i can create or write custom logic will be helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.