Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when extraType = by_price_of_physical_products in Classes/Domain/Model/Cart/Service.php #368

Open
vmans opened this issue Jan 3, 2022 · 0 comments
Assignees

Comments

@vmans
Copy link

vmans commented Jan 3, 2022

When you use virtual or downloadable products it's logical that these cost 0.00 euro.

When you add by_price_of_physical_products as extra type (to count only the gross price of products that are physically shipped), the base price is always counted.

This is my config example. Shipping costs 3 euro for actual shipments under 25 euro orders of simple products, thus excluding downloadable products.

plugin.tx_cart.shippings.countries {
    nl {
      preset = 1
      options {
          1 {
            title = Standaard
            extra >
            extra = by_price_of_physical_products
            extra {
              0 {
                value = 0.00
                extra = 3.00
              }
            }
            free.from = 25.00
            taxClassId = 3
            status = open
          }
      }
    }

It doesn't work. Not with only downloadable and not with mixed.

To make it work, in Services.php I made this change, I added

 if ((float)$conditionValue == 0) {
                        $extraValue['extra'] = 0;
                    }
            foreach ($this->config['extra'] as $extraKey => $extraValue) {
                if (is_array($extraValue) && ((float)$extraValue['value'] <= (float)$conditionValue)) {
                    if ((float)$conditionValue == 0) {
                        $extraValue['extra'] = 0;
                    }
                    $extra = new Extra(
                        $extraKey,
                        (float)$extraValue['value'],
                        (float)$extraValue['extra'],
                        $this->getTaxClass(),
                        $this->cart->getIsNetCart(),
                        $extraType,
                        $this
                    );
                }
            }
@extcode extcode self-assigned this Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants