10

I am facing a very strange issue after the installation of Magento 2.0.4. I have create a product with the price $12 and change the locale from Magento configuration in backend.

Below is the screenshot for the listing page.

enter image description here

Also find the below screenshot for the detail page.

enter image description here

You might have noticed the difference between two screenshot. Yes, Product detail page shows $0.00 price while listing page has retain with the price what i have added.

Product details page automatically updates correct price to $0,00 After one or two seconds ( Javascript Updates).

Find the below code for it

$('[data-price-type="' + priceCode + '"]', this.element).html(priceTemplate({data: price}));

I have debug further in the code and find another javascript code that passes parameter to Magento 2 pricebox widget.

<script>
    require([
        'jquery',
        'Magento_Catalog/js/price-box'
    ], function($){
        var priceBoxes = $('[data-role=priceBox]');

        priceBoxes = priceBoxes.filter(function(index, elem){
            return !$(elem).find('.price-from').length;
        });

        priceBoxes.priceBox({'priceConfig': <?php /* @escapeNotVerified */ echo $block->getJsonConfig() ?>});
    });
</script>

Now i have checked the getJsonConfig() method,

  $product = $this->getProduct();

        if (!$this->hasOptions()) {
            $config = [
                'productId' => $product->getId(),
                'priceFormat' => $this->_localeFormat->getPriceFormat()
                ];
            return $this->_jsonEncoder->encode($config);
        }

        $tierPrices = [];
        $tierPricesList = $product->getPriceInfo()->getPrice('tier_price')->getTierPriceList();
        foreach ($tierPricesList as $tierPrice) {
            $tierPrices[] = $this->priceCurrency->convert($tierPrice['price']->getValue());
        }
        $config = [
            'productId' => $product->getId(),
            'priceFormat' => $this->_localeFormat->getPriceFormat(),
            'prices' => [
                'oldPrice' => [
                    'amount' => $this->priceCurrency->convert(
                        $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue()
                    ),
                    'adjustments' => []
                ],
                'basePrice' => [
                    'amount' => $this->priceCurrency->convert(
                        $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount()
                    ),
                    'adjustments' => []
                ],
                'finalPrice' => [
                    'amount' => $this->priceCurrency->convert(
                        $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue()
                    ),
                    'adjustments' => []
                ]
            ],
            'idSuffix' => '_clone',
            'tierPrices' => $tierPrices
        ];

I did lot of debugging through the code and come to the conclusion that they are using ICUDATA for locale support.

I am stuck with this all thing, It seems it is PriceFormat issue.

Please make sure this issue arise only for certain Locale options like Persion (Iran).

  • Apply reindeix, clean cache, deploy static conent. – Suresh Chikani Apr 12 '16 at 9:17
  • Thanks @SHPatel, Its not a reindex or cache issue. i did everything possible. – Codrain Technolabs Pvt Ltd Apr 12 '16 at 9:26
  • This is a bug and has been reported previously to magento team. Check this for more details - github.com/magento/magento2/issues/4077 – Reena Parekh Apr 12 '16 at 9:37
  • Thanks @ReenaParekh , That bug reported by me. But i want solution to this issue because magento people will take time to update it in their next release or so. – Codrain Technolabs Pvt Ltd Apr 12 '16 at 10:39
0

this issue has been resolved , kindly update your Magento2 to latest Stable version

if you have installed from GIT & Composer follow these steps :

  • Than you must stach your changes
  • GIT PULL Latest Stable Branch i.e. 2.1
  • Composer Update
  • Upgrade Magento ( bin/magento setup:upgrade)

else if you have installed using zip folder download than download latest from magento website and override all files using new zip than you need to clear cache and run

bin/magento setup:upgrade
0

Upgrade the magento by following commands.

bin/magento setup:upgrade

bin/magento setup:db-schema:upgrade

php -d memory_limit=-1 bin/magento setup:di:compile

php -d memory_limit=-1 bin/magento setup:static-content:deploy

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.