Page 1 of 1

Change of prices creating warning messages

Posted: 30 Aug 2016, 00:46
by jossnaz
i am on 2016.07.2


when running my tax by state plugin i get when accessing the basket:

"Please have a look at the prices of the products in your basket"
"The price of at least one product has changed in the meantime and it was updated automatically"

what is the correct way to avoid these warnings / errors / infos when adjusting the tax rate for a basket depending on the state the user chose to be in.


i can just suppress them in the pages, but i doubt that is the correct way.


what I currently do is:

in
ff-laravel/ext/cmc-usa-salestax-by-state/client/html/templates/common/summary/detail-body-default.php


Code: Select all

if($errors){
  foreach($errors as $key_pe => &$pe){ //prodcuterror
    if(is_array($pe)){
      foreach($pe as $key_se => $single_error){
        if($single_error == 'price.changed'){
          unset($pe[$key_se]);
        }
      }
    }
  }
}

furthermore in:

ff-laravel/resources/views/cmc/aimeos/basket/cmc_basket_body.php

this file replaces the file:

Code: Select all

  'client' => array(
    'html' => array(
      'basket' => array(
        'standard' => array(
          'standard' => array(
            'template-body' =>
              __DIR__ . '/../resources/views/cmc/aimeos/basket/cmc_basket_body.php'
          )
        )
      ),
it has these new snippets:

Code: Select all

$checkout = true;
/** @var \Aimeos\MShop\Order\Item\Base\Standard $myBasket */
$myBasket = $this->standardBasket;
try {
  $myAddress = $myBasket->getAddress($domain = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
} catch (\Exception $e) {
  $myAddress = null;
}
try {
  $myBasket->check(\Aimeos\MShop\Order\Item\Base\Base::PARTS_PRODUCT);
} catch (Exception $e) {
  if ($e->getMessage() == 'Please have a look at the prices of the products in your basket') {
    $checkout = true;
  } else {
    $checkout = false;
  }
}
if ($myAddress == null) { ?>
  <style type="text/css">
    .total {
      display: none;
    }

    .tax {
      display: none;
    }
  </style>
<?php }

and:

Code: Select all

<?php
if (isset($this->standardErrorList)) {

  $temp_list = $this->standardErrorList;
  foreach ((array)$this->standardErrorList as $key => $errmsg) : ?>
    <?php if ($errmsg === 'Please have a look at the prices of the products in your basket' || $errmsg === 'The price of at least one product has changed in the meantime and it was updated automatically') {
      unset($temp_list[$key]);
    }

    ?>
  <?php endforeach;
  $this->standardErrorList = $temp_list;
  if (count($this->standardErrorList) == 0) {
    unset($this->standardErrorList);
  }
}
?>
that is, just remove the final error products as i don't want them to appear each time a user merely access the basket and my plugin was executed.

Re: Change of prices creating warning messages

Posted: 30 Aug 2016, 08:51
by jossnaz
probably just disable the plugin? that is, there is a plugin called "ProductPrice" Checks for changed product prices

probably just disable that one?

Re: Change of prices creating warning messages

Posted: 31 Aug 2016, 17:29
by aimeos
Yes, you have to disable that plugin because it will interfere with your own one.